Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a three level nav setup using Wordpress menu creator.

Structure:

A
—1
——Y
——Z
—2
—3
B
C

I wish to display each level of the navigation alone, in different areas of the page. With current items highlighted.

On pages A, B or C I want to display: A B C
(I can use wp_nav_menu with depth=1 for this)

On pages 1*, 2 or 3 I want to display: A B C and 1 2 3
On pages 1*, Y or Z I want to display: A B C, 1 2 3 and Y Z

Are there any easy ways of displaying the second and third level navs for the currently selected menu item?

The important thing is that I need to be able to display each "level" menu individually.

Thanks

share|improve this question
add comment

3 Answers

The easiest way is to override the walk() method in your custom walker when using wp_nav_menu

For a reference, see the code inside the walk() method inside the Walker_Nav_Menu class. That code first separates all top level menu items & puts all the submenu items separately. There you can further separate them out to use different start_el functions or outputting some other random html

share|improve this answer
add comment

You could maybe try getting the list of items and building it out yourself if you really need some more control, without the complexities that the Walker class involves.

http://codex.wordpress.org/Function_Reference/wp_get_nav_menu_items

share|improve this answer
add comment
up vote 0 down vote accepted

What I ended up doing was setting up three sidebars, each using an instance of Advanced Menu Widget and settings as follows:

Sidebars
1. main nav: start at level 0, display 1 level deep, display all items
2. second level nav: start at level 1, display 2 level deep, only show strictly related sub items
3. third level nav: start at level 2, display 3 level deep, only show strictly related sub items

This gives me pretty much the control I needed.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.