Title: Sub navigation functionality
Last modified: August 20, 2016

---

# Sub navigation functionality

 *  [jbiddulph](https://wordpress.org/support/users/jbiddulph/)
 * (@jbiddulph)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/sub-navigation-functionality/)
 * Hi,
 * On my site: [here](http://harveys.blueplanetdns.com/the-brewery/about-us/)
 * 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?!
 *     ```
       <?php
       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">
       <h2><?php
       $parent_title = get_the_title($post->post_parent);
       echo $parent_title;
       ?></h2>
       <ul>
       <?php wp_list_pages("title_li=&child_of=$parent" ); ?>
       </ul>
       </div>
       <?php endif; ?>
       ```
   

The topic ‘Sub navigation functionality’ is closed to new replies.

## Tags

 * [child](https://wordpress.org/support/topic-tag/child/)
 * [li](https://wordpress.org/support/topic-tag/li/)
 * [navigation](https://wordpress.org/support/topic-tag/navigation/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [jbiddulph](https://wordpress.org/support/users/jbiddulph/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/sub-navigation-functionality/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
