One of the greatest features in WordPress is the navigation menu system. Its been upgraded recently which makes it even more flexible while taking a bit longer to master.
Different themes offer different locations where you can display your primary and secondary menu’s. On top of this, Genesis enables you to easily change the locations where your menu’s display. To extend the functionality of your site further, you may want to only display one of your nav menus on specific pages and remove them from others.
In this tutorial, you’ll learn how to use different conditional tags to remove either menu from any pages so it only displays on the ones you want.
When Both Menu’s Display After Header
Assumes both your primary and secondary menu locations display after the header by default.
This code will remove the secondary (subnav) menu from your entire site excluding the page which matches the i.d in the code.
This code will remove the primary (nav) menu from your entire site excluding the blog page. Change the page name or page slug to exclude the menu from being removed on other pages.
When Primary Menu Displays Before Header
Assumes your primary menu displays before your header and the secondary menu displays after your header.
This code will remove the primary (nav) menu from your entire site excluding the blog page. Change the page name or page slug to exclude the menu from being removed for another page.
Secondary Category Menu Displays After Header
Assumes you’re using your secondary menu as your category menu and it displays after your header by default.
This code will remove the secondary menu (category menu) from your entire site excluding archives and single posts.
Example: !is_page('007') ! Excludes the conditional
All code assumes the primary navigation menu theme location is assigned the primary menu and the secondary navigation menu theme location is assigned the secondary menu.
Genesis Simple Menu’s Plugin
Prefer using a plugin to code?
Here’s a post about how to use the Genesis Simple Menu plugin which enables you to manually display both of your primary and secondary menu’s on specific pages from your edit screens.