WordPress.org

Ready to get started?Download WordPress

Forums

Display submenu only (4 posts)

  1. kilps
    Member
    Posted 4 years ago #

    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

  2. keesiemeijer
    moderator
    Posted 4 years ago #

    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;
     ?>
  3. kilps
    Member
    Posted 4 years ago #

    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

  4. jonas18z
    Member
    Posted 3 years ago #

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

    gallery->landscape->picture1

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags