WordPress.org

Ready to get started?Download WordPress

Forums

extended is_page() please? (3 posts)

  1. astorm
    Member
    Posted 9 years ago #

    Can it be extended so it supports something like:
    is_page('decendantOf=2')
    is_page('childOf=3')

    where 2 and 3 are the postID.

  2. Michael Adams (mdawaffe)
    Member
    Posted 9 years ago #

    You should file this as a feature request at http://mosquito.wordpress.org

    Good idea.

  3. Michael Adams (mdawaffe)
    Member
    Posted 9 years ago #

    For now, you can find if a Page is the child_of a particular Page:

    <?php
    if (3 == $post->post_parent) {
    // do something
    }
    ?>

    That must be used inside The Loop

    or
    <?php
    if (3 == $wp_query->post->post_parent) {
    // do something
    }
    ?>

    That can be used anywhere (inside or outside The Loop).

    A more generic descendent_of is harder.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.