I want two menus using the new WordPress 3.0 feature.

In functions.php I have:

function register_my_menus() {
     '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?


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().

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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