Another tutorial on Genesis Framework. By default, Genesis comes with two menus – Primary and Secondary Menus. This is really great and gives more flexibility to do further customization on your website. Sometimes you might want to use the different secondary menu on specific post and page. There are two ways to achieve this in Genesis, and in this tutorial, I’ll show you both of them.
1. Conditional Secondary Menu with Code Snippets
In this example, we’re removing secondary menu on the page with ID 10. 1. Is_page is the WordPress conditional tags. You may also use it for multiple posts and page or with other conditional tags such as is_home etc. Please refer to WordPress Conditional Tags in WordPress Codex for more info. 2. 10 in the bracket is the ID of post/page. Use Reveal IDs plugin to help you find out the ID of the post or page. 3. genesis_after_header is a hook specifically use with Genesis Framework. This is the default location for Secondary Menu in Genesis. See the Genesis Hook Reference page on StudioPress for more info. I also recommend using Genesis Visual Hook plugin to make life easier. 4. What the code does is basically remove the secondary menu in the post with ID: 10. To make the primary menu as the conditional menu, replace
2. Conditional Secondary Menu with Genesis Simple Menus plugin
This Genesis Simple Menus plugin was developed by StudioPress, the maker of Genesis Framework. The Genesis Simple Menus is available from WordPress.org Plugin repository for free. 1. Install and activate the plugin. 2. Create your menu. If you’re not familiar with this, read my tutorial – WordPress101: Using WordPress Menu. 3. Every time you open the post editor for post and page, you will see a new meta box. This is where you specify the menu to be used for that specific post and page. Of course, you are able to create as many menus as you wish and choose them from the drop-down.
Please note that this plugin uses your secondary menu. So make sure you don’t remove them. I found using plugin gives you more flexibility since you can create as many custom menu as you wish and use it at different places. This plugin was developed by StudioPress, so you can assure that the plugin is compatible with most Genesis child themes.
Credit to Victorfont.com for the code snippet.
Leave a Reply