Quantcast
Channel: Altschuler
Viewing all articles
Browse latest Browse all 60

How to add another menu in WordPress

$
0
0

First, add the following code in your functions.php file to register a new menu. In this example we call it “Secondary Menu.”

functions.php:

function register_secondary_menu() {
	register_nav_menu( 'secondary', __( 'Secondary Menu', 'This is the secondary menu' ) );
}
add_action( 'after_setup_theme', 'register_secondary_menu' );

In the admin dashboard, go to Appearance -> Menus. Click on the link, “create a new menu,” as shown below.

How to add another menu in WordPress

After you finish creating your menu structure, you will see a new option at the bottom under “Theme locations.” Select the menu that you registered. (In this example we registered a menu called “Secondary Menu”.)

How to add another menu in WordPress

Now add the following code in the template file (header.php, footer.php, etc.) where you want the menu to appear.

wp_nav_menu( array( 'theme_location' => 'secondary', 'menu_id' => 'secondary-menu' ) );

 


Viewing all articles
Browse latest Browse all 60

Trending Articles