Skip to main content

Timeline for How do I check if a menu exists?

Current License: CC BY-SA 3.0

7 events
when toggle format what by license comment
Oct 8, 2013 at 21:56 comment added Chip Bennett I still think there is an easier way to handle what you're trying to do. If you want to drop into chat, we could probably hash it out...
Oct 8, 2013 at 21:35 comment added justlemons I have several pages on the site and each parent page has a unique nav menu. Some children pages have unique nav menus as well but not all. For those children pages that do not have unique nav menus, then I want them to use their parent's nav menu. So, what I'm checking for is if the unique nav menu exists so I can display it, and if the page doesn't have a unique nav menu, then I want to display it's parent page's nav menu.
Oct 8, 2013 at 21:25 comment added justlemons Even though my client won't be managing the location of menus, he'll still have the ability to add new items to those menus if he so chooses.
Oct 8, 2013 at 21:23 comment added Chip Bennett Also: I'm confused by your question's title: how to tell if a menu exists?. If the user isn't defining menus, how will menus ever exist? I suspect that there's something else, deeper, that you're really trying to accomplish - and I suspect that there's probably an easier way than the way you're currently going about it. :)
Oct 8, 2013 at 21:21 comment added Chip Bennett "my client won't need the ability to manage nav menu locations" - then why have nav menus at all? (No: seriously.) Why not just use wp_list_pages() or wp_page_menu()? Because if the user isn't defining nav menus, then there's literally no reason at all to use wp_nav_menu().
Oct 8, 2013 at 21:19 comment added justlemons Thank you for your response. This is the first website I've ever developed using Wordpress, and I wasn't aware of needing to register my nav menus. I read the material you suggested. Still, I was able to solve my problem without registering them. I think it works for my purposes since my client won't need the ability to manage nav menu locations. If you think this will cause me problems down the road, please let me know.
Oct 8, 2013 at 18:00 history answered Chip Bennett CC BY-SA 3.0