Forums
Forums / Themes and Templates / Need help with Custom Menus
(@meltingdog)
14 years, 5 months ago
Hi all,
Im having all sorts of issues adding multiple custom menus to my theme.
I have this in my functions.php:
add_action(‘init’, ‘register_custom_menu’); function register_custom_menu() { register_nav_menu(‘custom_menu’, __(‘Custom Menu’)); register_nav_menu(‘specials_menu’, __(‘Specials Menu’)); register_nav_menu(‘footer_menu’, __(‘Footer Menu’)); }
and this in my nav areas:
<?php wp_nav_menu(array(‘menu’ => ‘specials_menu’)); ?> <?php wp_nav_menu(array(‘menu’ => ‘custom_menu’)); ?>
but they all display the same menu.
Can anyone help me out?
Thanks!
OK I think I have found the solution:
Replace the word ‘menu’ in <?php wp_nav_menu(array(‘menu’ => ‘specials_menu’)); ?>
to ‘theme_location’ e.g:
<?php wp_nav_menu(array(‘theme_location’ => ‘specials_menu’)); ?>
…but it would be good to know if this is correct way of doing this
The topic ‘Need help with Custom Menus’ is closed to new replies.