Ticket #14235 (closed enhancement: fixed)

Opened 19 months ago

Last modified 15 months ago

Add ability to remove ul tag from wp_nav_menu result

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

Description

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

menu_items_wrap_class.14235.diff Download (1.5 KB) - added by filosofo 19 months ago.

Change History

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 );
  • Keywords has-patch added; wp_nav_menu removed
  • Owner changed from spangborn to filosofo
  • Status changed from new to accepted
  • Milestone changed from Awaiting Review to 3.1
  • Status changed from accepted to closed
  • Resolution set to fixed

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

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