Make WordPress Core

Opened 14 years ago

Closed 13 years ago

Last modified 13 years ago

#14235 closed enhancement (fixed)

Add ability to remove ul tag from wp_nav_menu result

Reported by: spangborn's profile spangborn Owned by: filosofo's profile filosofo
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.0
Component: Template Keywords: has-patch
Focuses: Cc:


The new (and awesome) wp_nav_menu() function provides the ability to remove the "container" ( the DIV that wraps around the entire result), but you can't remove the UL that wraps the list items at present to only produce the list items. It'd be really awesome if it were possible to remove the UL tags, as it would enable theme designers/developers to use the new wp_nav_menu() inside of pre-existing UL's for things like inline navigation menus on the top of a page.

Attachments (1)

menu_items_wrap_class.14235.diff (1.5 KB) - added by filosofo 14 years ago.

Download all attachments as: .zip

Change History (5)

#1 @filosofo
14 years ago

I agree, and I think the way to do it is to be able to pass element patterns. So for example something like this, perhaps:

$args = array(
   'items_wrap' => '<ul id="%1$s" class="%2$">%3$s</ul>',
wp_nav_menu( $args );

#2 @filosofo
14 years ago

  • Keywords has-patch added; wp_nav_menu removed
  • Milestone changed from Awaiting Review to 3.1
  • Owner changed from spangborn to filosofo
  • Status changed from new to accepted

#3 @nacin
13 years ago

  • Resolution set to fixed
  • Status changed from accepted to closed

(In [16519]) Introduce items_wrap arg to wp_nav_menu(). props filosofo, fixes #14235.

#4 @nacin
13 years ago

(In [16520]) Escape the wrap ID and class attributes going into sprintf() and s/slug/wrap_id/ to make it more obvious. see #14235.

Note: See TracTickets for help on using tickets.