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.
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.