How to Add Second Navigation Menu to WordPress Child Theme (with Twenty Eleven or Twenty Twelve Parent)?

To add a secondary menu, you need to add the following code to your child theme functions.php file.

/*
secondary menu in child theme
*/
 register_nav_menus( array(
 'primary' => __( 'Primary Navigation', 'CHILDTHEME' ),
 'secondary' => __( 'Secondary Navigation', 'CHILDTHEME'),
 ) );

Now secondary navigation will appear on back-end Appearance > Menus, in left column. You may create a new secondary menu clicking on tab with +, on top of the page. Add menu items. Remember to save the new menu. Then assign it to secondary navigation in left column pane.

Add secondary menu to your child template with this code:

// secondary menu
wp_nav_menu( array('container_class' => 'SECONDMENUCLASS',
'theme_location' => 'secondary' ) );

Now we may style the second menu with CSS using the class name provided.

Update: This is also good for newest default TwentyTwelve theme! Checked.

Share:
This entry was posted in Templates, WordPress and tagged . Bookmark the permalink.

4 Responses to How to Add Second Navigation Menu to WordPress Child Theme (with Twenty Eleven or Twenty Twelve Parent)?

  1. Simon says:

    Hi,

    Great , simple tip. It worked. But as I can style the second menu now, I can’t make it a drop down menu. All menu elements are visible. Any ideas on this issue?

  2. Simon says:

    Hi,

    Any ideas how to enable the drop down effect on the created second menu? As for now all elements are visible – no drop-down.

  3. Thanks so much for this tutorial. It is just what I needed and it works. I discovered that WordPress menus for Twenty Eleven only allow 89 menu items before it goes haywire. I am in the midst of transferring an XHTML site over to WordPress and ran out of menu room for a section about our competition. Now I can have a separate menu for the competition pages. Just need to figure out how to create a new page template for the competition pages that will call in the header that includes the second menu because I won’t need it on all my pages.
    Thanks again.

  4. Pingback: How to Add Second Navigation Menu to WordPress Child Theme | Jimmy Knoll - Developer

Leave a Reply

Your email address will not be published. Required fields are marked *