Display correct menu based on if it contains current page
-
+ Admin creates a bunch of navigation menus via the appearance > menu admin screen.
+ These menus are not assigned to specific theme_locations. There could be dozens of these admin-created menus.
+ My single.php or single-customposttype.php would display the correct nav menu based on whether that nav menu contains the currently-viewed page.Ie: If nav menu contains a page with page id of this current page’s $post_ID, then return the nav menu.
Should I assume that I would use a custom walker that is passed the current page’s ID as an argument?
Then on my single.php or single-customposttype.php I’d use the wp_nav_menu() function with a “walker” argument pointing to this new walker object?
If so, any thoughts on modifying a walker that would do this?
Thank you!
- The topic ‘Display correct menu based on if it contains current page’ is closed to new replies.