Conditional content based upon is_page() not echoing as expected (4 posts)

  1. Gilad
    Posted 7 years ago #


    I have a block of code that looks like this:

    if (is_page()) {
    echo 'Something for Pages';
    } else {
    echo 'Something for Posts';

    Unexpectedly, the 'Something for Posts' shows on Pages as well as Posts.

    What am I doing wrong?

    Apologies for the lack of links - These experiments (my first WP sites, really) only exist on my dev box for now...


  2. cafefrenzy
    Posted 7 years ago #

    Gilad, I tested your code on one of my page templates in WP 2.7 and it worked perfectly. The 'Something for Posts' did not show up.

  3. Gilad
    Posted 7 years ago #

    Thanks for the quick assist!

    I'm still on 2.6 on this particular site. I wonder if this is only supposed to work in 2.7... Or if there is something else I have breaking me...

    I'll upgrade to 2.7 tonight and report back to this thread.

    Thanks again!

  4. Gilad
    Posted 7 years ago #

    Well, the upgrade had to be postponed, and then I forgot I owed a response to this thread... Silly me...

    Anyway - Once I upgraded to 2.7, the code behaved as expected.

    Thanks for the hint, cafefrenzy!


Topic Closed

This topic has been closed to new replies.

About this Topic