The Support Forums will be in read-only mode for a scheduled maintenance window on 01 September 2016 14:00 UTC - 20:00 UTC. More information.

sub sub sub menu (three levels) (1 post)

  1. ecdq
    Posted 5 years ago #

    I have this pages menu :


    On the page aa, I want to show the wp_list_pages aaa, aab & aac, If I'm on the page aaa, I want to show aaa, aab & aac (nothing else). How can I achieve this? For now, I have this code (and it's only working for the second level)

    global $wp_query;
    $post = $wp_query->post;
    $ancestors = get_post_ancestors($post);
    if( empty($post->post_parent) ) {
    $parent = $post->ID;
    } else {
    $parent = end($ancestors);
    if(wp_list_pages("title_li=&child_of=$parent&echo=0" )) { ?>

    <div id="secondary-nav" role="navigation" class="menu">

      <?php wp_list_pages("title_li=&child_of=$parent&depth=1" ); ?>

    </div><!-- #secondary-nav -->

    Thanls for your help!

Topic Closed

This topic has been closed to new replies.

About this Topic