Video: Adding a Second Menu to the WordPress Twenty Ten Theme
The Twenty Ten theme only comes with one default menu, which is included in the header. However the theme also supports multiple menus, thanks to the use of register_nav_menus(). Here’s a quick tip on how to take advantage of this function and add a second menu to the Twenty Ten theme.
Watch the Screencast
Functions.php
Open the functions.php file and look for:
// This theme uses wp_nav_menu() in one location.
The next line is where we see the register_nav_menus() being used. As you can see this function accepts an array.
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'twentyten' ),
) );
primary: this is a key, or name of the menu, this name should be unique within the array
__( ‘Primary Navigation’): this is the vaule of the key, or description of the menu
To add the second menu simply add another key (menu name) and assign a value (enter description) into the array. Here’s an example of what it can look like when adding your second menu:
register_nav_menus( array(
'primary' => __( 'Primary Navigation', 'twentyten' ),
'secondary' => __( 'Secondary Navigation', 'twentyten' ),
) );
This technique can be used in creating other free themes or child themes as well. If you have any questions, feel free to ask in the comment.
Comments
6 Responses to “Video: Adding a Second Menu to the WordPress Twenty Ten Theme”Share Your Opinions
Tell us what you're thinking...
and if you want a pic to show with your comment, then get gravatar!
Please make sure that you have read our Comment Policy.











Nice…I like how you move the cursor super slow!!!
Thank you for concise and to the point explanation. Appreciate the time you put into helping others by posting such helpful information.
I’m bummed that twentyten came with only one menu though. They should’ve atleast created two!
Thanks Though… looks easy enough.
Great tutorial, thanks. I was wondering how to use this for a child theme. I’m a novice to the functions.php and am not sure how to go about using the unhook filter instructions given by the wordpress codex.
Are you trying to create a child theme of your own? or are you trying to modify an existing one?
I created a child theme…a lot of trial and error since I’m new to that too. But could not get the menu right. Something went screwy with the primary navigation and I’m trying to figure out why. I’d created another menu in the menu manager but when I try to use it as the primary navigation, the entire menu bar disappears. I was wondering if it’s because I’d changed the header size.
In searching around for an answer, your tutorial seemed the more plausible fix.
I think i figured out why the menu bar was completely disappearing. But I’d still like to add the second menu into the child’s function.php instead of changing it through the dashboard’s editor.