Register Menus in functions.php
- Create the function. Here it is named theme_nav_menus. It can be whatever you want as long as there are no spaces.
- Add the call to register_nav_menus(). The array inside is a list of menu_id => menu_name pairs. You can name these whatever you like, but no spaces are allowed in menu_id.
- The add action is necessary or the function won't run. Make sure the name used, here it's theme_nav_menus, is exactly the same in the function name as it is in add_action.
The example below has three menus: main_nav, footer_nav and other_nav. To add a fourth you would put a comma after 'My Other Nav" and then another pair.
Creating a Menu
- Select Appearance > Menu
- You will not see the Theme Locations options until you craete the first menu
- Click the + sign and add a menu name and
- Click Create Menu to create your first menu.
Choose a Location for the Menu
Once you create a menu then the Theme Locations will appear (1). Use the dropdown to place the menu you made (2) in the appropriate place.
Add The Pages, Posts etc to the menu
Add the pages (or posts or categories or custom links) to you menu.
- Check what you want
- Click Add to Menu
You can drag the menu items around to reorder them and create subnavigation. You can also change the Label that people will see. Remember to click Save Menu (1) when you are done.
Checking "automatically add new top-level pages" (2) means that if you create a page (not a post) and it doesn't have a parent then it will be automatically added to this menu.
Add Other Menus
- You can click the + again to add another menu and
- set it to one of your other locations.