Make WordPress Core

Opened 14 years ago

Closed 10 years ago

Last modified 10 years ago

#14687 closed feature request (duplicate)

Add "collapsible" class to menu items that have children

Reported by: digitalnature's profile digitalnature Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.0.1
Component: Menus Keywords: has-patch
Focuses: Cc:


Items from custom menus in WP 3 have classes like:


and if the current menu item is active, also:




It would useful for theme developers if you also added another class on menu items that have children, like "collapsible", or "menu-with-children" :)

this will allow designers to add things like arrows in menus easier, without having to resort to javascript hacks to check if the list element has children...

Attachments (1)

Parent-menu-item.patch (797 bytes) - added by mobius5150 13 years ago.
Adds parent-menu-item class to menu items that have children

Download all attachments as: .zip

Change History (9)

#1 @nacin
14 years ago

  • Milestone changed from Awaiting Review to Future Release

#2 @mobius5150
13 years ago

  • Cc mike@… added
  • Keywords has-patch added
  • Version changed from 3.0.1 to 3.2

I found this while I was looking for a way to style parent menu items without using nasty javascript. I found a very nice solution here (basically taking the two added lines from this and adding it to the default WalkerNavMenu->display_element() function which simply checks to see if the menu item has children, and if so, appends the appropriate class to it.

I'll be preparing and attaching a patch ASAP.

13 years ago

Adds parent-menu-item class to menu items that have children

#3 @SergeyBiryukov
13 years ago

  • Version changed from 3.2 to 3.0.1

Version number is used to track when the bug was initially reported.

#4 @ocean90
12 years ago

Duplicate: #20191

#5 @cramdesign
12 years ago

  • Cc matt@… added

The patch looks great. Does this ticket still have any traction? Nacin's post was so long ago.

#6 @SergeyBiryukov
11 years ago

#24644 was marked as a duplicate.

#7 @celloexpressions
10 years ago

  • Resolution set to duplicate
  • Status changed from new to closed

This was fixed in #23834. There is now a class menu-item-has-children for parent menu items.

#8 @helen
10 years ago

  • Milestone Future Release deleted
Note: See TracTickets for help on using tickets.