I want to register two additional menus that will replace my primary menu in the header on certain templates. The code I am using in function.php is

remove_action( 'genesis_after_header', 'genesis_do_nav' );
add_action( 'genesis_header', 'genesis_do_nav', 12 );

function register_additional_menus() {
    register_nav_menu( array(
        'loc-menu' => 'Location Menu',
        'org-menu' => 'Organisation Menu'
    ) );

    add_action( 'init', 'register_additional_menus' );  
}

add_theme_support ( 'genesis-menus' , array ( 
    'primary'   => __( 'Primary Navigation Menu', 'genesis' ),
    'loc-menu'   => __( 'Location Navigation Menu', 'genesis' ),
    'org-menu'   => __( 'Organisation Navigation Menu', 'genesis' )
) );

add_action( 'genesis_header', 'do_additional_menus' ); 

function do_additional_menus() {
    genesis_nav_menu( array( 
        'theme_location' => 'loc-menu',
        'container'       => 'div',
        'container_class' => 'wrap',
        'menu_class'      => 'menu genesis-nav-menu'
    ) );

    genesis_nav_menu( array( 
        'theme_location' => 'org-menu',
        'container'       => 'div',
        'container_class' => 'wrap',
        'menu_class'      => 'menu genesis-nav-menu'
    ) );
}

And an example of the code I am using to pull a menu in on the template is:

add_theme_support( 'genesis-menus', array( 'org-menu' => __( 'Organisation Navigation Menu', 'genesis' ) ) );

The trouble I am having is the two new menus – loc-menu and org-menu – appear on all templates regardless of if I have added the theme support or not. Please can someone help me on how to hide these menus?

Thanks

Read more here: Hiding additional menus on WordPress Genesis Framework


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: