WordPress.org

Ready to get started?Download WordPress

Forums

Stop is_front_page || is_home returning TRUE on posts page (4 posts)

  1. James Morrison
    Member
    Posted 2 years ago #

    Hi,

    Under Reading Settings, I have set a static homepage and blog page which is causing is_home() || is_front_page to return TRUE on the defined posts page.

    Is there a quick code snippet which can be used to stop this returning TRUE so the code in the header will only appear on the homepage and not on subpages?

    I can cheat and remove the posts page (and therefore need a custom page template to add the blog page) but surely this functionality is either built in or can be filtered?

    Many thanks,

    James

  2. James Morrison
    Member
    Posted 2 years ago #

    Hi,

    Just to elaborate on this, this is the content of header.php: http://pastebin.com/FsaNGERu

    I only want $title_tag to return h1 on the actual homepage, not on the blog page.

    Many thanks,

    James

  3. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    http://codex.wordpress.org/Conditional_Tags

    is_home() is the conditional tag for the posts page;

  4. James Morrison
    Member
    Posted 2 years ago #

    Hey,

    Thank you, removing is_home and simply using is_front_page has done the trick!

    Many thanks,

    James

Topic Closed

This topic has been closed to new replies.

About this Topic