WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 2 years ago

#15282 closed enhancement (invalid)

wp_nav_menu now displays menu depth

Reported by: edward mindreantre Owned by:
Priority: normal Milestone:
Component: Menus Version:
Severity: normal Keywords: reporter-feedback
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 3 years ago.

Download all attachments as: .zip

Change History (7)

comment:1 nacin3 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 westi3 years ago

  • Keywords reporter-feedback added

comment:3 edward mindreantre3 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 filosofo3 years ago

How about

ul.menu > li > ul

or

ul.sub-menu > li > ul

etc.

comment:5 edward mindreantre3 years ago

Can't reproduce the way you say.

ul > li

nails all the lis under the ul.

comment:6 nacin2 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.