WordPress.org

Ready to get started?Download WordPress

Forums

If is child of parent, but not actual parent page? PHP (1 post)

  1. gotmedia
    Member
    Posted 2 years ago #

    Hi there,

    I'm trying to do an if statement that says:

    If you're on a child of a specific parent page:
    SHOW THIS

    then later:

    If you're on that specific parent page:
    SHOW THIS

    -----------------------------------------

    I have the code for this, but they conflict. Right now the children work, but the parent page doesn't. What I'm trying to do is: the children are press articles and the parent page is a list that displays them.

    <?php if ( $post->post_parent=="701" ) { ?>
    <p>Child of parent page 701.</p>
    <?php } ?>

    <?php } if ( is_page(701) ) { ?>
    <p>Parent page.</p>
    <?php } ?>

    Thoughts? Help?

Topic Closed

This topic has been closed to new replies.

About this Topic