It’s friday night and I am blogging. Better yet, it’s friday night and I am working. So while we are dorking out…I might as well take this time to bitch about a function I discovered in WordPress.
In the pre 2.5 versions, there is a function called is_home(). This is deprecated (no longer used but left for backwards compatibility). Any decent programmer will automatically assume this is a Boolean function. It will return a 1 if we are indeed on the homepage and 0 (or blank) if we are not. Pretty simple…right?
Well for some reason this function wasn’t working…even on the homepage. So I had to look it up. I read through the WordPress Codex and I felt like a GIANT douche bag looking up is_home(). I have been coding for over 10 years and I am looking up is_home().
With no help from the documentation I have discovered that is_home() will only work if you are not setting a static page as your homepage. You MUST be using index.php (or home.php) and have it set to show your dynamic posts. But index.php and home.php are template pages specifically for the home page.
So this code checks to see if I am on the homepage on the homepage? Huh? Exactly. This is like me calling you at home and then asking if you are at home.
The only scenario I can see this actually working is on an included sidebar, footer, or header. But even then, what are you adding that can’t just be added to the homepage template? I guess WP got rid of it for a reason. But now for the real quesiton…what da phuk am I am doing home right now? :’(