WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] How to Target Static Posts Page (3 posts)

  1. kingstringy
    Member
    Posted 2 years ago #

    Here are the details:
    • made a static page my front page and specified another page to work as my posts page (titled 'Blog') using the Reading settings.
    • in header.php, I wrote a simple if/else if statement to serve up a different header image depending on which page it is, using (for example) is_page('Blog') as the conditional.
    • it works with all the pages except the Blog page, which picks up the default image no matter how I try to refer to the Blog page (title, slug, etc).
    • I tried using is_posts_page, but since most pages are posts pages of one kind or another, that trumps my default image in undesired ways.

    I have a feeling that the error is occurring because of the Reading settings and I'm just not putting in the right identifier to target that page, but I'm also not clear on why the is_page isn't working, since the page still has a title and the title is being used in the function.

    Any help/insight is appreciated.

  2. alchymyth
    Forum Moderator
    Posted 2 years ago #

  3. kingstringy
    Member
    Posted 2 years ago #

    Thanks, alchymyth. That worked perfectly. I figured it would be something obvious I was missing.

    A note to anyone else who runs into the same problem:
    in the if statement, when I used is_home to target my Blog page and is_front_page to target my static home page (titled 'Welcome', also set through the Reading settings), I got the same image on both pages. Switching the if statement back to is_page('Welcome') put the images in the right places.

Topic Closed

This topic has been closed to new replies.

About this Topic