• I am using WP as a CMS with a custom theme that has home.php and a WP Page entitled “Blog” with a custom template. WP is in a “wordpress” dir and the site URL is located at http://mydomain/.

    When I browse to either the site URL or the Blog Page (ie http://mydomain/?page_id=1) is_home returns true. I would expect is_home() to only return true when at the site URL. Is this the correct expected behavior or is this a bug in is_home()?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Its intended.

    is_home refers to very first page that is displayed “BY DEFAULT”. That means, if you changed the home page to display a static page, is_home returns false.

    Silliness, I know.

    As a substitution, use compare bloginfo(‘url’) with the current url to find out if it is the front page.

    I believe a is_frontpage() will come out in 2.4… or hopefully anyway.

    Thread Starter drphil9001

    (@drphil9001)

    Ah, that is a little silliness, but not what is going on in my situation (I think).

    I am not using the Options->Reading pane to set a static home page and the blog page. I have a home.php in my theme that is used to render the home page (with no blog entries). I then have a WP Page called Blog with its own template to render blog entries. I simply put links to it in my header.php.

    So is_home() returns true when home.php is rendered AND true when the blog page is rendered. My problem isn’t that when home.php is rendered that is_home is true, but rather the page I use to display blog entries. So right now I have to have check to see if I am on the home page and not on the blog page to get the “active” page to show properly in my header.

    I’m having a similar issue — I can’t get WP to recognize my true home page. Comparing the url of the current page with bloginfo(‘url’) will work for me. Problem is, I don’t know how to retrieve the url of the current page. Any ideas? Thanks.

    gulflee

    (@gulflee)

    i m facing this prob too
    if is themes isu then u have to work more
    <php if(is_page() || (is_category() || is_single() ) { } ?>
    this maybe help in a mean while.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘is_home bug?’ is closed to new replies.