Family Encyclopedia >> Electronics

Video Adding a Second Menu to the Twenty Ten WordPress Theme

The Twenty Ten theme only comes with a default menu, which is included in the header. However, the theme also supports multiple menus, thanks to the use of register_nav_menus(). Here is a quick tip on how to take advantage of this feature and add a second menu to the Twenty Ten theme.

Watch the Screencast

Functions.php

Open the functions.php file and find:

// Este tema usa wp_nav_menu () en una ubicación.

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 menu name, this name must be unique within the array

__( 'Primary Navigation'): This is the key wand, or menu description.

To add the second menu, just add another key (menu name) and assign a value (enter description) in the array. This is an example of what it might look like when you add your second menu:

 register_nav_menus (array ('primary' => __ ('Primary Navigation', 'twentyten'), 'secondary' => __ ('Secondary Navigation', 'twentyten'),)); 

This technique can be used to create other free themes or child themes as well. If you have any questions, feel free to ask in the comment.