WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] is_home doesn't respect page_on_front option (4 posts)

  1. scottconnerly
    Member
    Posted 3 years ago #

    I have set the Home to be a page, have set the blog to be a secondary page, /news/.

    is_home() is only showing as true on /news/ and my template file 'home.php' is loading for /news/.

    is_front_page() is respecting the page_on_front option.

    It looks like the issue is with $this->is_singular is being included in the evaluations for is_home in parse_query().

    Is there another way to make it so that the page_on_front option is respected? Its not like I have any crazy loops going on here, its just a simple page.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    I'd suggest reviewing Conditional_Tags - specifically what is_home() and is_front_page() test for.

    I think you're compounding the confusion by using home.php as your template file name. home.php is a reserved name on many servers. Try renaming the template to homepage.php.

  3. scottconnerly
    Member
    Posted 3 years ago #

    From the Conditional Tags page:
    --snip--
    so if you've set a static Page for the Front Page (see below), then this will only be true on the Page which you set as the "Posts page"
    --snip--

    So you're saying the home page isn't going to be the home page? The root of the blog is going to be the is_home page?
    Odd.

  4. esmi
    Forum Moderator
    Posted 3 years ago #

    is_home() is only showing as true on /news/

    This is the correct behaviour for is_home(). It's true only on your main posts page.

    If you're using a static front page, you need to look at is_front_page(). Also, do take note of what I said about your template file name. It can cause confusion and, in some case, significant site display issues.

Topic Closed

This topic has been closed to new replies.

About this Topic