• Resolved rbgiddings

    (@rbgiddings)


    I am creating a custom theme from scratch, and having issues with registering multiple menu locations. Note that I have created other custom themes with multiple menus and they all work fine!

    Basically, the same menu is showing up in all three menu locations. I’ve tried deactivating all plugins to no effect.

    I am working in a multisite environment. The site is currently a subdomain of a separate website, but we will give it a unique URL when it’s complete. The site is http://outcomes.campuscareercoach.com/

    Here’s the code from my functions.php file:

    register_nav_menus(
    	array(
    	'header-nav' => 'Main Nav, Header',
    	'footer-learn' => 'Main Nav, Footer',
    	'footer-help' => 'Help Nav, Footer'
    	)
    );

    The first menu, “header-nav” is in the header.php file. It works great:

    <?php
    		$header_nav = array(
    		'theme_location' => 'header-nav',
    		'container' => false,
    		'depth' => -1
    		);
    	?>
        <?php wp_nav_menu( $header_nav ); ?>

    Then, in the footer.php file, I place the two other menus. These are the two that aren’t working. They just repeat menu items of the “header-nav” menu.

    <?php
    		$footer_learn = array(
    		'theme-location' => 'footer-learn',
    		'container_id' => 'footer_left',
    		'items_wrap' => '<ul><li class="white"><strong>Learn More</strong></li>%3$s</ul>',
    		'depth' => -1
    		);
    	?>
        <?php wp_nav_menu( $footer_learn ); ?>
    
        <?php
    		$footer_help = array(
    		'theme-location' => 'footer-help',
    		'containter_class' => 'none',
    		'container_id' => 'footer_left2',
    		'items_wrap' => '<ul><li class="white"><strong>Survey Help</strong></li>%3$s</ul>',
    		'depth' => -1
    		);
    	?>
        <?php wp_nav_menu( $footer_help ); ?>

    The WP Admin is showing that I have three menu locations registered, and I have a separate menu assigned to each location. You can see a screenshot here.

    I would appreciate any and all help!

Viewing 4 replies - 1 through 4 (of 4 total)
  • Have you reviewed http://codex.wordpress.org/Function_Reference/register_nav_menus ?

    Why aren’t you using associative arrays? Why are you using the same slug (Main Nav)for two different menus?

    Thread Starter rbgiddings

    (@rbgiddings)

    @esmi, I believe I am using associative arrays – my code looks exactly like the codex section you referenced. And I’m not using the same slugs for the separate menus – both “header-nav” and “footer-learn” have the words “Main Nav” in the description, but it’s not the slug. The slugs are unique.

    Thread Starter rbgiddings

    (@rbgiddings)

    Does anyone have any help for me? I still haven’t found a solution.

    Thank you!

    Thread Starter rbgiddings

    (@rbgiddings)

    I realized what the issue was – I had a simple typo. I was using ‘theme-location’ instead of ‘theme_location’. I can’t believe it took me so long to find that error!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Multiple menu locations showing same menu’ is closed to new replies.