WordPress.org

Support

Support » Themes and Templates » Display submenu only

Display submenu only

  • Hi

    In previous versions of WordPress if I wanted to display a list of child pages I’d just use something like:
    <ul><?php wp_list_pages('title_li=&child_of='.$post->ID); ?> </ul>
    as described at http://codex.wordpress.org/Template_Tags/wp_list_pages

    I have been trying to work out how to do this with the new menu system in 3.0 and so far have found nothing. Can anyone help?

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator keesiemeijer

    @keesiemeijer

    try this:
    <ul><?php wp_page_menu('title_li=&child_of='.$post->ID); ?> </ul>
    It will parse the arguments of wp_list_pages.
    if you want it in a variable

    <?php
    $html = wp_page_menu('title_li=&child_of='.$post->ID. '&echo=0');
    echo $html;
     ?>

    As far as I can tell that is still displaying the page structure (when I change the menu structure it still displays sub-pages as opposed to sub-menu items)

    Thanks

    jonas18z

    @jonas18z

    This works but is is it possible to limit in only 1 depth?

    gallery->landscape->picture1

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Display submenu only’ is closed to new replies.
Skip to toolbar