WordPress.org

Support

Support » How-To and Troubleshooting » Coding Question on Using the php code widget for sidebar

Coding Question on Using the php code widget for sidebar

  • Hi all,

    I am using the php code widget (http://wordpress.org/extend/plugins/php-code-widget/) to call different custom menus on different pages.
    The custom menu is basically all the child pages of a given page.
    (If Page1 has Child A, B, C, D, the custom menu is a list of A, B, C, D)
    The code I put to do that looks like this:

    <?php if (is_page(‘Page1’)): ?>
    <h3 class=”widgettitle”>Pagename</h3>
    <?php wp_nav_menu(‘menu=Children of Page1’); ?>
    <?php endif; ?>

    It works great, but with this the custom menu only shows up on Page1.

    Is there a short and smart way to show the same custom menu for Child A, B, C, D, as well, without putting the same code above for each child page?

    i.e. something like:
    <?php if (is_page(‘Page1’)): ?>
    <and also if page=child of page1>

    Thanks!

  • The topic ‘Coding Question on Using the php code widget for sidebar’ is closed to new replies.