Title: add submenu/ subnavigation to WordPress theme
Last modified: August 19, 2016

---

# add submenu/ subnavigation to WordPress theme

 *  [domoritz](https://wordpress.org/support/users/domoritz/)
 * (@domoritz)
 * [15 years, 7 months ago](https://wordpress.org/support/topic/add-submenu-subnavigation-to-wordpress-theme/)
 * Hi
 * I want to add a submenu of a wordpress menu into my theme. I want to use the 
   wp_nav_menu function of WordPress 3.0. And in other words, I want to see the 
   submenu not the subpages which means that wp_list_pages is not the right function
   because I want the **submenu** and not the **subpages**.
 * Let’s assume the menu structure looks like that:
 * – Home
    – Entry1 — Entry3 — Entry4 – Entry2 — Entry5 — Entry6
 * I want that if someone clicks on Entry1 (and makes it the parent) the Theme just
   shows the submenu of this entry. In the case of Entry1 it’s:
 * – Entry3
    – Entry4
 * I know that there is a code like that:
 *     ```
       <?php
               $children = ($post->post_parent) ? wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0') : wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');
               if($children) { echo('<ul>'.$children.'</ul>'); }
            ?>
       ```
   
 * However, the point is that I’m talking about the menu structure and **not** the
   page structure. Oh, and the depth parameter does not work because it means _to_
   here and not _from_ here.
 * I think there could be a solution with a custom walker but I don’t know how to
   implement that.
 * Function reference for wp_nav_menu
    [http://codex.wordpress.org/Template_Tags/wp_nav_menu](http://codex.wordpress.org/Template_Tags/wp_nav_menu)
 * I’m looking for a solution for this problem for so long so please help me. Thanks
   a lot.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [harmus](https://wordpress.org/support/users/harmus/)
 * (@harmus)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-submenu-subnavigation-to-wordpress-theme/#post-1678635)
 * Put `$subMenuArray = array();` in your functions.php and add use this walker:
 * [http://pastebin.com/V57D1M3k](http://pastebin.com/V57D1M3k)
 * It’ll get your submenu’s in an array ($subMenuArray), ordered by the id of the
   parent item.
 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/add-submenu-subnavigation-to-wordpress-theme/#post-1678636)
 * Does your menu have things other than Pages in it (or is your menu structured
   other than your Parent-Child Page relationships), such that wp_list_pages() wouldn’t
   work for you?
 *  [nellisbasson](https://wordpress.org/support/users/nellisbasson/)
 * (@nellisbasson)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/add-submenu-subnavigation-to-wordpress-theme/#post-1678646)
 * Where does one change the way it looks then? Have been struggling with this forever.
   It doesn’t matter what I do or where I change it, it keeps showing as a list,
   thats underlined. how does one put it next to one another?
 * Thank you so much in advance!
 *  [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * (@chipbennett)
 * [14 years, 11 months ago](https://wordpress.org/support/topic/add-submenu-subnavigation-to-wordpress-theme/#post-1678647)
 * **[@nellisbasson](https://wordpress.org/support/users/nellisbasson/):** yours
   sounds like a separate issue. You should start a separate thread.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘add submenu/ subnavigation to WordPress theme’ is closed to new replies.

## Tags

 * [menu](https://wordpress.org/support/topic-tag/menu/)
 * [navigation](https://wordpress.org/support/topic-tag/navigation/)
 * [sub-menu](https://wordpress.org/support/topic-tag/sub-menu/)
 * [Walker](https://wordpress.org/support/topic-tag/walker/)

 * 4 replies
 * 4 participants
 * Last reply from: [Chip Bennett](https://wordpress.org/support/users/chipbennett/)
 * Last activity: [14 years, 11 months ago](https://wordpress.org/support/topic/add-submenu-subnavigation-to-wordpress-theme/#post-1678647)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
