3

I've got two wp_nav_menu's defined - main and sub. The backend menu editor lets me add pages or categories or custom links to my menu, and I can place them under existing pages/categories/links.

However, I want to add my sub pages to the sub menu, and then be able to add that sub menu as a whole item to my main menu.

That way, if I change up what's in my sub menu, I don't also have to go change my main menu too, see what I mean. Nice and DRY. Useful if I have my submenu in multiple places (like as a drop down from the main menu, plus on a detail page in the sidebar.)

Is this possible? Is there a plug in or custom function? Thanks.

1

You could perhaps accomplish this via a custom walker, but I suggest you try a single menu containing submenus and display the submenus in other contexts by outputting just that branch of the main menu. see Display a portion/ branch of the menu tree using wp_nav_menu(), specifically this answer.

  • Hmmm, interesting approach, I didn't think of that, I guess it can work, but it's still rather complex, especially for end users. I was hoping to find a way to add an "add menu" metabox with a dropdown of other menues. If I don't get a closer answer I'll credit your answer as a possible alternate solution. – Jeff Jul 17 '12 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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