1

I set my 'About' page as home page, its permalink (my_site/about/) became my_site/ as a result. Is_page('about') returns TRUE on my local server but FALSE on online server.

Why is that ?

1 Answer 1

3

You can use the function is_front_page().

Put this where you want to check if is frontpage

if( is_front_page() ) {
    echo 'I am the frontpage';
}

It returns TRUE when the main blog page is being displayed and the Settings->Reading->Front page displays is set to "Your latest posts", or when is set to "A static page"

4
  • Works, thanks Pontus! Just out of curiosity, what could cause the difference of behaviour between local and online servers?
    – drake035
    Commented Jan 29, 2013 at 16:14
  • Maybe you did forget to set the correct template? Commented Jan 29, 2013 at 16:21
  • Hmm nope, I am quite sure it was the right template.
    – drake035
    Commented Jan 29, 2013 at 16:26
  • Okey, its hard to say from here. But good its working now :)! Commented Jan 29, 2013 at 16:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.