Support » Requests and Feedback » extended is_page() please?

  • astorm

    (@astorm)


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

    where 2 and 3 are the postID.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Michael Adams (mdawaffe)

    (@mdawaffe)

    Member

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

    Good idea.

    Moderator Michael Adams (mdawaffe)

    (@mdawaffe)

    Member

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘extended is_page() please?’ is closed to new replies.