Opened 15 years ago
Closed 15 years ago
#13597 closed defect (bug) (fixed)
Using the same menu in multiple theme_location resulting in duplicate ids
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 3.0 | Priority: | normal |
Severity: | minor | Version: | 3.0 |
Component: | Menus | Keywords: | has-patch |
Focuses: | Cc: |
Description
I've a site using multiple menus. The menu are registered this way
if ( function_exists('register_nav_menus') ) { register_nav_menus( array( 'social-top' => 'Top social menu', 'social-bottom' => 'Bottom social menu', ) ); }
I wish to use the same menu (named social) for the two theme locations. I call the menu with these args :
<?php $menu_args = array( 'container' => '', 'theme_location' => 'social-top', // and social-bottom the next time ); wp_nav_menu($menu_args); ?>
Resulting in the same opening tag for the two menus (since the id is constructed using the menu slug), which is not W3C valid :
<ul id="menu-social"><!-- found twice in the same page -->
The "container_id" option described here http://codex.wordpress.org/Function_Reference/wp_nav_menu seems to have no effect.
Attachments (1)
Change History (5)
Note: See
TracTickets for help on using
tickets.
I think you can use wp_get_nav_menu_items() and wp_get_nav_menus() for have more control in the custom menus