WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] display only on specific subpages (3 posts)

  1. Boris
    Member
    Posted 6 years ago #

    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!

  2. Kafkaesqui

    Posted 6 years ago #

    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)

  3. Boris
    Member
    Posted 6 years ago #

    Thanks a lot, worked perfectly!

Topic Closed

This topic has been closed to new replies.

About this Topic