Codex tools: Log in
Languages: English • 日本語 • (Add your language)
Contents |
Displays a navigation menu created in the Appearance → Menus panel.
Given a theme_location parameter, the function displays the menu assigned to that location, or nothing if no such location exists or no menu is assigned to it.
If not given a theme_location` parameter, the function displays
<?php wp_nav_menu($args); ?>
<?php $defaults = array(
'menu' => ,
'container' => 'div',
'container_class' => ,
'container_id' => ,
'menu_class' => 'menu',
'menu_id' => ,
'echo' => true,
'fallback_cb' => 'wp_page_menu',
'before' => ,
'after' => ,
'link_before' => ,
'link_after' => ,
'depth' => 0,
'walker' => ,
'theme_location' => );
?>
<div class="access"> <?php wp_nav_menu(); ?> </div>
<?php wp_nav_menu( array('menu' => 'Project Nav' )); ?>
<div id="access" role="navigation">
<?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff */ ?>
<div class="skip-link screen-reader-text"><a href="#content" title="<?php esc_attr_e( 'Skip to content', 'twentyten' ); ?>">
<?php _e( 'Skip to content', 'twentyten' ); ?></a></div>
<?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is
the one used. If none is assigned, the menu with the lowest ID is used. */ ?>
<?php wp_nav_menu( array( 'container_class' => 'menu-header', 'theme_location' => 'primary' ) ); ?>
</div><!-- #access -->
<?php
function my_wp_nav_menu_args( $args = '' )
{
$args['container'] = false;
return $args;
} // function
add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );
?>
OR
<?php wp_nav_menu( array( 'container' => '' ) ); ?>
wp_nav_menu() is located in wp-includes/nav-menu-template.php.
Navigation Menu: register_nav_menus(), register_nav_menu(), wp_nav_menu(), wp_get_nav_menu(), wp_get_nav_menu_item()