There may be some cases where you want to add a secondary menu to your WordPress theme, for example for a Members only section. This tutorial will run you through how to set it up and add it into a page template.
To create a custom menu follow these steps:
Next we want to use the menu inside a custom page template. To achieve this, we need to create a new theme location by adding the following snippet of code into your functions.php file:
If you now go back to your menu via 'Appearance' > 'Menus' and click on the 'Manage Locations' tab you'll see there is now a second theme location available.
Select your new menu and tick the new theme location. If you don't do this your new location will default back to the primary menu.
To use this new menu, you now need to add the following code to the template where you want it to appear:
You can read more about the other arguments that can be passed into the wp_nav_menu function in the WordPress Codex.
If you want to restrict the menu so that only visitors who are logged in can view it, simply wrap the following code around the wp_nav_menu function: