In my website i'm using two separate nav_menus, one to the legal pages and other for the main navbar... For some reason some items of the main menu are appearing in the secondary menu, even though in the backoffice the menu is correct
Backoffice display of the menu
Website screenshot displaying the menus:
wp query of the main menu
$argsMenu = array('theme_location' => 'Main');
<?php wp_nav_menu($argsMenu); ?>
wp_query of the secondary menu
<?php wp_nav_menu($menuSecondary = array(
'container' => 'div',
'container_class' => 'menu__secondary__content',
'menu_class' => 'menu__secondary',
'echo' => true,
'items_wrap' => '<div class="menu__secondary__wrap">%3$s</div>',
'theme_location' => 'Seconday',
)); ?>
Thanks in advance , its a simple problem that is making me insane
In my website i'm using two separate nav_menus, one to the legal pages and other for the main navbar... For some reason some items of the main menu are appearing in the secondary menu, even though in the backoffice the menu is correct
Backoffice display of the menu
Website screenshot displaying the menus:
wp query of the main menu
$argsMenu = array('theme_location' => 'Main');
<?php wp_nav_menu($argsMenu); ?>
wp_query of the secondary menu
<?php wp_nav_menu($menuSecondary = array(
'container' => 'div',
'container_class' => 'menu__secondary__content',
'menu_class' => 'menu__secondary',
'echo' => true,
'items_wrap' => '<div class="menu__secondary__wrap">%3$s</div>',
'theme_location' => 'Seconday',
)); ?>
Thanks in advance , its a simple problem that is making me insane
Share Improve this question asked Jan 10, 2020 at 18:04 Pedro FerreiraPedro Ferreira 1791 silver badge10 bronze badges 3- 1 do you have a typo in 'theme_location' => 'Seconday'? 'Seconday' instead of 'Secondary'? – Captain S. Commented Jan 10, 2020 at 18:17
- this is my code : register_nav_menus(array( 'Main' => 'Header Menu', 'Secondary' => 'Secondary Menu', )); – Pedro Ferreira Commented Jan 13, 2020 at 8:49
- it was a typo , fixed it ! such a stupid mistake ! thanks – Pedro Ferreira Commented Jan 13, 2020 at 9:32
1 Answer
Reset to default 0I am sure you went down this path already, but be sure register menus and support for theme:
register_nav_menus(
array(
'Main' => 'Main Navigation',
'Secondary' => 'Secondary Menu'
)
);
And then follow your pattern of 'theme_location' => 'Secondary'
to print your registered menu back.