Issue
I am developing a new WordPress theme, and I need two menus, the main menu, and the footer menu. This is what I have in functions.php:
if ( function_exists('register_nav_menus')) {
register_nav_menus(
array(
'main' => 'Main Menu',
'footermenu' => 'Footer Menu'
)
);
}
And, I am calling two menus, one in header.php and other in footer.php:
<?php $main_menu = array('menu' => 'main', 'container' => 'nav' ); wp_nav_menu( $main_menu ); ?>
<?php $footer_menu = array('menu' => 'footermenu', 'container' => 'nav' ); wp_nav_menu( $footer_menu ); ?>
I am also assigning both menus a different menu in WordPress Menus Manager, but in both menus, only the menu I assign to the first one is shown. I don’t know why. Can anybody help me solve this?
Thanks.
Solution
Okay, I’ve solved this. Instead of menu
, I had to use theme_location
, because this represents the menu chosen from the menu admin panel.
Answered By – Amar Syla
This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0