How do I avoid ID conflicts if I use the same menu TWICE on one page.
FIRST
wp_nav_menu( array( 'sort_column' => 'menu_order',
'theme_location'=>'menu', 'menu_class'=>'menu', 'menu_id'=>'menu' ) );
SECOND:
wp_nav_menu( array( 'sort_column' => 'menu_order',
'theme_location'=>'menu', 'menu_class'=>'menu2', 'menu_id'=>'menu2' ) );
ID conflicts are like “Duplicate ID menu-item-2456″… Any solutions?
The solution is not to call the same
'theme_location'
more than once. Theme location is intended to represent an explicit location within the template.Just register a separate
'theme_location'
for each separate location within the template that you want to display a nav menu.Consider your chosen
'theme_location'
names to be semantic names, representing the template location of the menu. You could use'primary'
and'secondary'
, or'header'
and'footer'
, etc.:…or:
Then, it is up to the end user to assign custom menus to each Theme Location.