Support » Fixing WordPress » display only on specific subpages

  • Resolved Boris

    (@travel-junkie)


    Hello,

    I have been using this code to display certain things only on subpages of a certain page (203 in this case):

    <?php global $post;
    if (($post->post_parent > 0) && !is_page('203')){ ?>
    Stuff to display
    <?php } ?>

    Now I have just realized that this gets displayed on every subpage, not just where 203 is the parent. Does anyone know how to fix that? Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Kafkaesqui

    (@kafkaesqui)

    If you are just trying to get it to work on child Pages of (parent) Page 203, this should be enough:

    if ($post->post_parent == 203)

    Boris

    (@travel-junkie)

    Thanks a lot, worked perfectly!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘display only on specific subpages’ is closed to new replies.