Support » Fixing WordPress » Conditional tag for blog page not working

  • rembem

    (@rembem)


    I am using WP 2.5.1,
    In Settings>Reading, I have set the Posts page to a static page called “My blog”
    Everything works correctly, the posts show up on this page.

    My problem is that I cannot find a single way to target this page with Conditional Tags. It does not react to is_page, is_archive, is_date, nothing.
    The id of the “My blog” page in the tree is 4. I’ve tried is_page(‘4’), even tried is_page_template().

    The only thing it reacts to is excluding everything:
    !is_date() and !is_page() and !is_category() and !is_archive() and !is_single()

    I don’t get, why this page is not an archive and not a page…

    Any ideas?
    Thanks, Remco

Viewing 7 replies - 1 through 7 (of 7 total)
  • lexhair

    (@lexhair)

    How about using is_front_page()? It’s new in WP 2.5.

    moshu

    (@moshu)

    Well, that’s not what the OP wants.
    When you select a “frontpage” you need to select a “posts page”, too.

    is_front_page – works for..err, the frontpage.
    Nothing works for the “posts page”; just checked.

    rembem

    (@rembem)

    Yes that was also my conclusion.
    Excluding everything is the only option, and targeting the other pages.

    thanks guys.

    Doodlebee

    (@doodlebee)

    Actually, this – in a roundabout way – solved *my* problem. I have a static page (“Welcome”) set as my home page, and another Static page (“Articles”) set as my blog page.

    If I use the if(is_home()) conditional, the blog page would pick it up.

    I didn’t know about the “if(is_fonrt_page())” option. When I used that, my home page (“Welcome”) saw *that* conditional and applied it. I could then use the “is_home()” for the blog pages, wthout affecting the index page.

    So that should solve your problem – target it as home and you’ll get what you need done.

    rembem

    (@rembem)

    Thanks for your post Doodlebee!

    I just tried and it works, I never thought of using ‘is_home’ for the blogpage. I thought of ‘is_home’ as meaning is_frontpage…

    You saved my day.

    Wow, only just stumbled on this post today. I’ve been looking for a solution for that problem all week!

    Using “is_home()” definitely works!

    @seanaus120

    SAME HERE! Great post…and lame tag: “is_home()” seriously? LOL

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Conditional tag for blog page not working’ is closed to new replies.