Sub navigation functionality (1 post)

  1. jbiddulph
    Posted 3 years ago #


    On my site: here

    I would like the subnavigation only to show when a user clicks on the parent that has children, I alo want to show the parent title

    at the moment, my left mavigation shows eveything and when I click on the sub navigation (child) the parent link disapears?!

    global $wp_query;
    if( empty($wp_query->post->post_parent) ) {
    $parent = $wp_query->post->ID;
    } else {
    $parent = $wp_query->post->post_parent;
    } ?>
    <?php if(wp_list_pages("title_li=&child_of=$parent&echo=0&depth=1" )): ?>
    <div id="submenu">
    $parent_title = get_the_title($post->post_parent);
    echo $parent_title;
    <?php wp_list_pages("title_li=&child_of=$parent" ); ?>
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic