WordPress – is_home() not working

For several days now, I have been caught out with the problem that a plugin is not functioning the way it should be.

My problem begun when a Mootools slideshow plugin breaks a jQuery plugin having hide/show functionality. I have searched solutions to prevent this conflict but nothing works. The recommended solution is the jQuery.noConflict() function. It fails to solve the conflict though so I decided to separate the two plugins by having the slideshow on the frontpage and the hide/show on another page. That was when I tried using tried using the is_home and the is_front_page WordPress functions.

I noticed that the is_home and the is_front_page function are not functioning when the jQuery show/hide functionality is not getting triggered to hide the content as expected. The WordPress forum solution is not something I wanted as everything is hard-coded. I need something more dynamic.

I have experimented on some alternatives to is_home() function but if I change my permalinks to SEO friendly URLs, the code breaks again. I was getting desperate until I figured out the function that works on normal or SEO URLs.

/**
* This function is an alternative
* to the built-in WordPress is_home()
* function
*/

function is_home_alternative()
{
   $result = false; 
   if ( basename ( $_SERVER['REQUEST_URI'] ) == basename ( get_bloginfo('wpurl') ) ): 
      $result = true;
   else:
      $result = false;
   endif;
   return $result;
}

If the page displayed is the frontpage or the home page, this statement will be true regardless of the permalink setting of WordPress.

basename ( $_SERVER['REQUEST_URI'] ) == basename ( get_bloginfo('wpurl') )