Title: Show Sub-navigation on custom &#8216;single.php&#8217; template?
Last modified: August 19, 2016

---

# Show Sub-navigation on custom ‘single.php’ template?

 *  [5-squared](https://wordpress.org/support/users/5-squared/)
 * (@5-squared)
 * [16 years, 3 months ago](https://wordpress.org/support/topic/show-sub-navigation-on-custom-singlephp-template/)
 * Hi There,
 * I’m fairly new to WordPress, but am so far very impressed with it’s power and
   ease of use. I’m building a site for a client that uses a variety of custom templates/
   functionality.
 * Please see my example here: [http://www.summermatters.org/wordpress/contact-us/staff](http://www.summermatters.org/wordpress/contact-us/staff)
 * That page simply pulls in all posts with the category of ‘staff’. I then have
   a custom single.php page that uses a few if/else statements which basically says
   if page category = ‘staff’ serve up template x.
 * Everything is working great. My question has to do with the main and sub navigation.
   Notice when you leave the staff page and get sent to the custom single page, 
   the “contact us” in the main-nav is no longer highlighted, and the sub-nav is
   empty.
 * In the main-nav, I’m wondering if there is anything I can pass to the navigation
   code that tells it which item to add the class of ‘active’ to. (so that I can
   highlight ‘contact us’ on the custom single.php template)
 * In the sub-nav, I am wondering if there is anything I can pass to the navigation
   code that tells it A: which sub-nav to pull in, and B: which item to add the 
   class of ‘active’ to.
 * My goal is to maintain the main and sub navs so that when the user visits the
   custom single.php template, nothing changes besides for the content, and it looks
   like they never left that section.
 * I really appreciate any help on this one.
 * Code I’m using to pull in the sub-nav:
 *     ```
       <ul id="nav_sub">
       <?php
       if($post->post_parent)
       $children = wp_list_pages("sort_column=menu_order&depth=1&title_li=&child_of=".$post->post_parent."&echo=0"); else
       $children = wp_list_pages("sort_column=menu_order&depth=1&title_li=&child_of=".$post->ID."&echo=0");
       if ($children) { ?>
       <?php echo $children; ?>
       <?php } ?>         </ul>
       ```
   
 * Code I’m using to pull in the main-nav:
 *     ```
       div id="nav_main">
               <div class="mid">
               <ul class="sf-menu">
               <?php wp_list_pages('title_li=&depth=2'); ?>
               </ul>
               </div><!-- end mid -->
       ```
   

The topic ‘Show Sub-navigation on custom ‘single.php’ template?’ is closed to new
replies.

 * 0 replies
 * 1 participant
 * Last reply from: [5-squared](https://wordpress.org/support/users/5-squared/)
 * Last activity: [16 years, 3 months ago](https://wordpress.org/support/topic/show-sub-navigation-on-custom-singlephp-template/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
