sage icon indicating copy to clipboard operation
sage copied to clipboard

items_wrap being overwritten on wp_nav_menu

Open FellowshipAgency opened this issue 14 years ago • 2 comments

If you create a wp_nav_menu eg:

            <?php  wp_nav_menu(array('menu' => 'Primary Navigation', 'depth' => 0 , 'items_wrap' => '<ul class="primaryNav sf-menu">%3$s</ul>')); ?>

The items_wrap is being completely ignored because it is overwritten in line 592 of cleanup.php.

FellowshipAgency avatar Jul 03 '12 13:07 FellowshipAgency

I believe this can be sorted by only changing the default arguments created by wp_nav_menu to the Roots friendly versions. Placing them within an if statement will mean that customised containers or wraps will not be overwritten.

 if ($args['container'] == 'div') {
  $roots_nav_menu_args['container']  = false;
  }

 if ($args['items_wrap'] == '<ul id=\"%1$s\" class=\"%2$s\">%3$s</ul>') {
  $roots_nav_menu_args['items_wrap'] = '<ul class="%2$s">%3$s</ul>';
  }

The alternative would be to add to the array and check for that but I think the above makes more sense.

Foxaii avatar Jul 03 '12 20:07 Foxaii

this was just fixed by abcfc5200a499572ae4887598c6dd13652ffdfc4 thanks to @sanchothefat

retlehs avatar Jul 14 '12 14:07 retlehs