This is very short WordPress tips, which will let you know how to register a new menu in WordPress. Sometimes we need to create multiple menus to display on the front-end, due to client requirements.
In this tutorial, I will share a simple code snippet to register a new menu on your WordPress site.
Open functions.php file and add the below at the end of the file and save it.
You can change the menu name as you want.
// Use register_nav_menus function to register new menu .
'secondary' => __( 'Secondary Menu', 'twentysixteen' ),
'footer' => __( 'Footer Menu', 'twentysixteen' ),
'social' => __( 'Social Menu', 'twentysixteen' ),
After adding the above code in your functions.php file, login to your Admin panel and navigate to the Appearance =>Menus. There you see the registered menus. See the below screenshot.
Now you can call above menus in your theme’s or template files by using the wp_nav_menu() function. See the below example:
'theme_location' => 'secondary',
'menu_class' => 'secondary-menu',
If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.