How to Add a Second Menu in Genesis Theme

If you’re unfamiliar with its hooks, Genesis can be a bit tricky to edit. Recently, we had to add a secondary menu to theme, and this is how we did it. We needed to add a second menu underneath the primary menu which was in the header. Here’s the code for it.

First register the menu:

// add second menu
if ( ! function_exists( 'xyz_register_other_navigation_menus' ) ) {

// Register Navigation Menus
function xyz_register_other_navigation_menus() {

	$locations = array(
		'secondary-nav' => __( 'Second Nav Menu', 'Not Any' ),
	);
	register_nav_menus( $locations );

}

// Hook into the 'init' action
add_action( 'init', 'xyz_register_other_navigation_menus' );

}

Next, create the secondary menu and output it in the desired place using the genesis_after_header hook.

add_action( 'genesis_after_header', 'xyz_genesis_secondary_nav', 20 );
function xyz_genesis_secondary_nav() {
	
	$args = array(
	'menu' => 'Second Menu',
	'menu_class' => 'menu genesis-nav-menu menu-secondary responsive-menu',
	'container_class' => 'wrap'
	);

	echo '<nav class="nav-secondary">';
	wp_nav_menu( $args );
	echo '</nav>';

}

If your menu doesn’t show up quite where you want it, experiment changing the integer (20 above) to a higher or lower number depending on if you want it after or before where it outputs.

By |2018-10-01T06:17:27+00:00August 21st, 2014|Blog|0 Comments

About the Author:

Matt is a marketer and WordPress expert. Founder of Scepter, Matt oversees the larger web dev projects for the company. Seeing innovative ideas come to life is his passion, and therefore he pushes Scepter ahead to help our customers bring their projects to life.

Leave A Comment