WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] is_home() not working (5 posts)

  1. gzezza
    Member
    Posted 7 years ago #

    I noticed that is_home() does not return true when you are using a static page as your Front page in WP 2.1
    The alternative suggested in 49832 works (if you change the != into ==):
    <?php if ($_SERVER['QUERY_STRING'] == '') { ?>
    ... home page stuff ...
    <?php } ?>

    but I was wondering if there were other solutions.

  2. gzezza
    Member
    Posted 7 years ago #

    I finally found a link to the discussion where they make the point that is_home() should not return true if you choose a static front page.
    So in WP 2.1 is_home() is assumed to return false when the home page is not from the blog, and there is nothing wrong with that...

  3. functionista
    Member
    Posted 7 years ago #

    i'm a bit confused with all this – I'm NOT using a static front page, but for me, is_home is returning TRUE for all pages! Can't I limit it to only the default front page of blog posts?

  4. Sapphire
    Member
    Posted 6 years ago #

    This isn't resolved - I'm having the same trouble as functionista now that I've upgraded to 2.3. The Is_frontpage doesn't help - it removes the stuff off the front page of blog posts, too.

  5. shacker
    Member
    Posted 6 years ago #

    If you're using a static page for your front page, then you need to figure out the ID of that static page - let's say it's 23 - and use this:

    if (is_page('23')) { ... }

    This works fine in WP 2.3.1

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags