wordpress

Detect WordPress Home Page / Front Page

Chances are you want to have slightly different content for the home page of your WordPress blog. In theory it should be easy enough, use is_home() or is_front_page(). Sadly these methods are hit and miss to say the least. Instead try using:

if ($_SERVER["REQUEST_URI"] == '/' || $_SERVER["REQUEST_URI"] == '/index.php')
{
    // Your home page specific code here
}

It’s not ideal, but it works.

Posted by Dan in PHP, 0 comments