Support » Fixing WordPress » is_home works….is_front_page doesn't

  • I’m sure I’m missing something obvious here, I just need to call a custom header.php file for a static home page. I’m able to call it for the blog page (News) and it works, when I switch to “is_front_page” nothing happens.

    I’ve tried the reset query solution to no effect. Here’s the code I’m using:

    if (is_front_page()) :
    else :

    I’ve never had problems with this before, so I’m wondering what I’m missing. I’ve even tried calling the specific page, is_page(’32’) with no luck. The only page I can get my custom header on is the blog page.

    Thanks for any help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Check your setting in the admin menu: Settings->Reading->Front page displays. Are you displaying a static page or your latest posts? Depending on this setting decides how these two functions act.

    is_home() is a function that returns true when the “blog posts index page” is loaded. It works on blog pages only. (Codex)

    is_front_page() is a function that returns true depending on the setting in your Settings->Reading->Front page displays. If you are set to “Your latest posts” it returns true just like is_home() when you are on the page showing your latest posts. If the option is set to “A static page” and your static home page is showing, the function will return true only on that page. (Codex)

    What is selected on your Settings >> Reading ? “Your Latest posts” or “static page (Home, Blog)”. If “Your Latest posts” is selected you have to use is_home() instead.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘is_home works….is_front_page doesn't’ is closed to new replies.