patric-boehner
7/1/2016 - 5:32 PM

Genesis Modern Studio Pro Theme Menu Structure

Genesis Modern Studio Pro Theme Menu Structure

//* Move Secondary Menu to Primary on Mobile
	setupMenus();

	$( window ).resize( function () {
		setupMenus();
	});

	function setupMenus() {
		if ( window.innerWidth <= 768 ) {
			$( 'ul.menu-secondary > li' ).addClass( 'moved-item' ); // tag moved items so we can move them back
			$( 'ul.menu-secondary > li' ).appendTo( 'ul.menu-primary' );
			$( '.nav-secondary' ).hide();
		}

		if ( window.innerWidth > 768 ) {
			$( '.nav-primary .genesis-nav-menu, nav .sub-menu' ).removeAttr( 'style' );
			$( '.responsive-menu > .menu-item' ).removeClass( 'menu-open' );
			$( '.nav-secondary' ).show();
			$( 'ul.menu-primary > li.moved-item' ).appendTo( 'ul.menu-secondary' );
		}
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.

//* Menus
//**********************

//* Rename Menus
add_theme_support( 'genesis-menus', array( 'primary' => __( 'Left Navigation Menu' ), 'secondary' => __( 'Right Navigation Menu' ) ) );

//* Modify Menu Structure
add_action( 'genesis_after_header', 'pb_menus_container' );
function pb_menus_container() {
	echo '<div class="navigation-container">';
	do_action( 'pb_menu_relocate' );
	echo '</div>';
}

//* Relocate Primary (Left) Navigation
remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'pb_menu_relocate', 'genesis_do_nav' );

//* Relocate Secondary (Right) Navigation
remove_action( 'genesis_after_header', 'genesis_do_subnav' );
add_action( 'pb_menu_relocate', 'genesis_do_subnav' );

//* Remove output of primary navigation right extras
remove_filter( 'genesis_nav_items', 'genesis_nav_right', 10, 2 );
remove_filter( 'wp_nav_menu_items', 'genesis_nav_right', 10, 2 );