wp_nav_menu() displays a navigation menu created in the Appearance → Menus panel. This function allow the final users to add or remove links within menus without putting their hands in the code. Basics is build with four navigation menus: the first is located at the top left of the page, but it isn’t activated by default (you may not need it). The second display the main menu below the Slogan. The third and the fourth can be used as the first one, within the optional Widget Areas.
Basics uses wp_nav_menu() in four locations (functions.php)
/** * This theme uses wp_nav_menu() in four locations. */ register_nav_menus( array( 'first' => __( 'First navigation', 'basics' ), 'second' => __( 'Second navigation', 'basics' ), 'third' => __( 'Third navigation', 'basics' ), 'fourth' => __( 'Fourth navigation', 'basics' ) ) );
Calling the main menu (header.php)
<?php wp_nav_menu( array( 'theme_location' => 'second', 'container' => 'div', 'menu_class' => 'site-navigation' ) ); ?>
Do you want to know more?
- Function Reference/wp nav menu — The wp_nav_menu() Codex page
- Goodbye, headaches. Hello, menus! — Very good tutorial on wp_nav_menu()
- Item Wrap argument — Excellent explanation of the $items_wrap argument by Thomas Scholz