WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 3 years ago

Last modified 3 years ago

#14235 closed enhancement (fixed)

Add ability to remove ul tag from wp_nav_menu result

Reported by: spangborn Owned by: filosofo
Milestone: 3.1 Priority: normal
Severity: normal Version: 3.0
Component: Template Keywords: has-patch
Focuses: 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 (1)

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

Download all attachments as: .zip

Change History (5)

comment:1 filosofo4 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 );

comment:2 filosofo4 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

comment:3 nacin3 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.

comment:4 nacin3 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.