• Resolved kvnmcwebn

    (@kvnmcwebn)


    I have two custom menus going in a footer.
    When I was using this <?php ( wp_nav_menu (‘Footer-nav’) ) ?> to call each menu the same menu items were getting rendered for each location.

    When I used this: <?php wp_nav_menu( array( ‘container’ =>”,’fallback_cb’ => ”, ‘depth’ => 1, ‘theme_location’ => ‘Footer-two’ ) ); ?> for one menu it renders correctly in the correct location. But.. the other custom footer menu being called with <?php ( wp_nav_menu (‘Footer-nav’) ) ?> also renders the links from the “Footer-two”.
    I have them both registered, both have menu items.
    Under each location the correct men is selected. What is the proper way to call two custom menus that are in two different divs?

    This is the function:

    add_action( 'init', 'my_custom_menus' );
    function my_custom_menus() {
    	register_nav_menus(
    		array(
    			'Footer-nav' => __( 'Footer-nav' ),
    			'Footer-two' => __( 'Footer-two' )
    	 		)
    	);
    }

    This is the call in the footer:

    <div id="footernavone">
    <?php ( wp_nav_menu ('Footer-nav') ) ?>
    </div>
    
    <div id="footernavtwo">
    This is footer two
    <?php wp_nav_menu( array( 'container' =>'','fallback_cb' => '', 'depth' => 1, 'theme_location' => 'Footer-two' ) ); ?>
    
    </div>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter kvnmcwebn

    (@kvnmcwebn)

    oh and if I use:

    <?php wp_nav_menu( array( 'container' =>'','fallback_cb' => '', 'depth' => 1, 'theme_location' => 'Footer-two' ) ); ?>

    to call both items I just get an error. So there is something in the way that I’m calling them that I’m not getting right.

    Just a suggestion. Try registering your menus like so.

    //Register Navs
    register_nav_menus( array(
    	'footer_nav' => 'Footer Nav',
    	'footer_two' => 'Footer Two'
    ) );

    Then call them like so

    //Call Navs
    <div id="footernavone">
    <?php wp_nav_menu(array('menu' => 'Footer Nav')); ?>
    </div>
    <div id="footernavtwo">
    <?php wp_nav_menu(array('menu' => 'Footer Two')); ?>
    </div>
    Thread Starter kvnmcwebn

    (@kvnmcwebn)

    very nice thanks jay.

    Reviewing the codex it is kind of confusing, Im not sure of the difference between this and this. Im not sure why they say to wrap register_nav_menus in a function like you had it when it is a function itself. Maybe someone smarter then me can explain, because I would like to know as well. Maybe Alchymyth can explain it, he is pretty good at that. Either way, Im glad you got it working.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘custom menu duplicating items from one menu to the other.’ is closed to new replies.