By: Prem Tiwari | Last Updated:
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',
Prem Tiwari is the founder of FreeWebMentor.com and also a professional developer who has vast experience in PHP and open source technologies. Apart from this, he is a blogger by hobby and also he has been a regular speaker of WordPress sessions in various IT Companies. View all posts by Prem Tiwari