• Resolved mtm

    (@flatpack-music)


    i’m doing what i’ve done in a bunch of sites before for which i’ve needed two distinct menus but this time am finding that whichever menu i create second in the WP admin area is applied to both nav-menu areas indiscriminately.

    both menus are in the footer of wpb.matmartin.co.uk

    from the functions.php file of my theme:

    add_theme_support( 'menus' );
    add_action( 'init', 'register_my_menus' );
    
    function register_my_menus() {
    	register_nav_menus(
    		array(
    			'nav-menu' => __( 'Nav Menu' ),
          'info-menu' => __( 'Info Menu' ),
    		)
    	);
    }

    and from the footer.php file:

    <div class="foot-nav-l">
                        <h4>navigation</h4>
                        <ul class="menu-l">
                            <?php wp_nav_menu(array('menu' => 'nav-menu', 'container' => '', 'items_wrap' => '%3$s')); ?>
                        </ul>
                    </div>
                    <div class="foot-nav-r">
                        <h4>info</h4>
                        <ul class="menu-r">
                            <?php wp_nav_menu(array('menu' => 'info-menu', 'container' => '', 'items_wrap' => '%3$s')); ?>
                        </ul>
                    </div>

    the two menus i want to use are already present in the menu section of the WP admin area, and assigned to the two areas, which carry through into the theme’s functionality just fine.

    i’m sure i’ve just missed something basic but a lack of accurate search terms on my part leaves me unable to find a solution to this. it’s very frustrating.

    thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Jose Castaneda

    (@jcastaneda)

    THEME COFFEE MONKEY

    Rather than using 'menu'=>'$name' try 'theme_location'=>'info-menu'

    Thread Starter mtm

    (@flatpack-music)

    bingo – thank you very much jose.

    i’ll mark this as resolved but if you had a moment to explain to me why that worked i’d be very interested! : )

    thanks again – that had been driving me nuts.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘wp_nav_menu calls not distinct’ is closed to new replies.