• Resolved Andy

    (@andythreecoaching)


    Hi,

    Recently began implementing some php in the form of the very useful:

    is_page ()

    But then I did a check for if the page was the blog so:

    <?php if (is_page('Life Coaching Service')) {?> ORANGE <?php } elseif (is_page('Personal Trainer Services')) {?> GREEN <?php } elseif (is_page('Blog')) {?> BLUE <?php } else { ?> MAIN <?php }?>

    But the blog isn’t a page as such, like the others. Any suggestions on how to run a check for it?

    Thanks

Viewing 5 replies - 1 through 5 (of 5 total)
  • According to Conditional Tags

    is_home()
    When the main blog page is being displayed. This is the page which is showing the time based blog content of your site, so if you’ve set a static Page for the Front Page (see below), then this will only be true on the Page which you set as the “Posts page” in Administration > Settings > Reading.

    Thread Starter Andy

    (@andythreecoaching)

    Brilliant, that worked first time.

    Thanks a lot.

    Thread Starter Andy

    (@andythreecoaching)

    Ooops. Spoke to soon.

    It works for the blog home page but not for the rest of the blog.

    I think you might have mentioned this but I’m not 100% sure on what you mean?

    You might have to resort to other conditionals like

    if (! is_page()) {

    or is_archive

    Thread Starter Andy

    (@andythreecoaching)

    Ah, he’s good.

    ! is_page()

    That did it. The is_archive didn’t work so well.

    Thanks a bunch.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘'is_page' doesn't work for the blog section?’ is closed to new replies.