Reputation: 1
When I'm trying to show either one of my secondary menus in Wordpress it will display the primary menu ('main-menu') again instead of 'footer-menu'
or 'info-menu'
. I use the following code to display my menu:
wp_nav_menu( array(
'theme-location' => 'info-menu',
'depth' => 1,
'container' => false,
'menu_class' => 'nav-info',
'fallback_cb' => 'wp_page_menu')
);
And I registered my menus in function.php
:
function register_my_menu() {
register_nav_menus(
array(
'main-menu' => __( 'Main Menu', 'ibasketball' ),
'footer-menu' => __( 'Footer Menu', 'ibasketball' ),
'info-menu' => __( 'Info Menu', 'ibasketball' )
)
);
}
add_action( 'init', 'register_my_menu' );
Any help is much appreciated.
Upvotes: 0
Views: 805
Reputation: 2314
You have a typo in your code theme-location
should be theme_location
Try wp_nav_menu(array('theme_location' => 'info-menu'));
it will work
Upvotes: 1
Reputation: 3358
From codex, there is only one parameter available in register_nav_menus
Usage
<?php register_nav_menus( $locations ); ?>
Parameters
$locations
(array) (required) An associative array of menu location slugs (key) and descriptions (according value).
Default: None
Refer codex for more detail codex
Upvotes: 0