WordPress.org

Support

Support » WP-Advanced » is_page equivalent for parents

is_page equivalent for parents

  • I’m using the ‘is_page’ function in some templates to display different pieces of code on certain pages.

    For example:


    <?php
    if (is_page('whoweare')) {
    echo '<img src="/wp-content/themes/b2gnat/images/title_elsewhere_whoweare.png" width="178" height="17" alt="Elsewhere in Who We Are" />';
    } else {
    echo '';
    }
    ?>

    What I’m wondering is if there is a way to do the equivalent for child pages. For example, on any given child the template could query and figure out who the parent is, and if that matches display some code, if not display other code.

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘is_page equivalent for parents’ is closed to new replies.