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

Read 2 min

In This Blog

Start your Project Vector

Start your project with a free discovery call and see how we can bring your vision to life.

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.

More Blogs

Let’s Grow Vector Something Great Together.

Whether you need more leads, smoother systems, or both — we’ll build a growth engine that scales with you
Let’s Grow Something Great Together.