Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I want two menus using the new WordPress 3.0 feature.

In functions.php I have:

function register_my_menus() {
 register_nav_menus(
    array(
     'header-menu' => __( 'Header Menu' ),
     'top-menu' => __('Top Menu')
   )
 ); 
}

add_action( 'init', 'register_my_menus' );

And in header.php I have:

<?php wp_nav_menu( array( 'name' => 'Header Menu' ) ); ?>
....
<?php wp_nav_menu( array( 'name' => 'Top Menu' ) ); ?>

Now they seem to fallback or something, always showing the same menu. The menus have been defined and setup in wp-admin "theme-locations".

Why won't they load appropriately?

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

wp_nav_menu() does not have a name argument. Instead, you should use theme_location.

With register_nav_menus(), you indicate that you have two locations in your theme where you can display a menu. The user can then create multiple menus, and assign them to these locations. This is why we have the indirection via theme_location. If you know the ID, slug or name of the menu you want to use, you can use the menu argument of wp_nav_menu().

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.