<?php
if ( function_exists('has_nav_menu') && has_nav_menu('primary-menu') ) {
wp_nav_menu( array( 'sort_column' => 'menu_order', 'container' => 'ul', 'menu_id' => 'main-nav', 'menu_class' => 'nav fl', 'theme_location' => 'primary-menu' ) );
} else {
?>
I’m trying to add a secondary menu from WordPress menu management in my functions.php
of my child theme for Woothemes Canvas.
I figure there’s a way to add it to the array above but I can’t get it to work. Thoughts?
Jason, you first need to register your ‘new’ (secondary) menu with register_nav_menu() like:
You do this in your theme’s functions.php file.
Then you’re able to call that menu in your template files. To use your code above, you’ll probably want something like:
or maybe
The second one will output both menus if they both exist, the first one will probably be used in addition to the one you posted in your initial question.
But in my case, I did not use the init action, just put the menu register function in my child theme’s function.php file