Exclude Last Level of Multi-Level Nav Menu
-
I have a rather strange request, searching through Google and directly through these support forums doesn’t return anything useful, so the best option is to post a new question… Honestly, this should probably be in the ‘Advanced’ forum, but obviously I can’t start a new thread there. ??
I’m looking for a way to exclude only the last level of links in a navigation menu with multiple levels. Some menu options have only one level of children, while others have two levels.
An example of the menu structure (trimmed):
<ul class="dropdown"> <li>Home</li> <li>Top Level</li> <ul class="child"> <li>Child Level</li> <!-- This must be excluded --> </ul> <li>Top Level</li> <ul class="child"> <li>Child Level</li> <!-- This must be included --> <ul class="grandchild"> <li>Grandchild Level</li> <!-- This must be excluded --> </ul> </ul> <li>About</li> </ul>
I know I can do this through either CSS or jQuery after the navigation has been built, but I’m hoping this is possible with some manipulation of the $depth argument in wp_nav_menu.. However, perhaps this would require my theme to have a custom function based on the default wp_nav_menu function?
Either way, I’m unfortunately not experienced enough in PHP to write a custom function of that level, so I need some assistance with this. If anybody has an idea of how to achieve this, or any suggestions on a method to get the desired result, please let me know? If you could at least post suggestions for this, I’ll dig into the functions and work it out myself. I’m just looking for some direction to get me going…
- The topic ‘Exclude Last Level of Multi-Level Nav Menu’ is closed to new replies.