WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

#15282 closed enhancement (invalid)

wp_nav_menu now displays menu depth

Reported by: edward mindreantre Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Menus Keywords: reporter-feedback
Focuses: Cc:

Description

Adds sub-menu-depth-1 and menu-item-depth-2 classes to the ul and li classes when displaying wp_nav_menus.

This is useful for fanciful jquery manipulation of the menu.

Attachments (1)

nav-menu-template.16095.diff (212 bytes) - added by edward mindreantre 4 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 @nacin4 years ago

  • Keywords menu wp_nav_menu depth template removed

I don't see why this is needed, at least based on the use case.

Depth can be targeted with li, li li, etc. And even better via jQuery.

comment:2 @westi4 years ago

  • Keywords reporter-feedback added

comment:3 @edward mindreantre4 years ago

As far as I know, saying ul ul in the css will target ALL under-ul tags of the first ul.

I know of no css selector that selects the first or second depth

comment:4 @filosofo4 years ago

How about

ul.menu > li > ul

or

ul.sub-menu > li > ul

etc.

comment:5 @edward mindreantre4 years ago

Can't reproduce the way you say.

ul > li

nails all the lis under the ul.

comment:6 @nacin4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This is doable with proper selectors, including child selectors and first/last pseudo-selectors.

Note: See TracTickets for help on using tickets.