[wp-trac] [WordPress Trac] #28620: When $depth argument is used in wp_nav_menu last level menu items still have .menu-item-has-children class, even though they are not shown
WordPress Trac
noreply at wordpress.org
Sun Dec 6 18:43:07 UTC 2015
#28620: When $depth argument is used in wp_nav_menu last level menu items still
have .menu-item-has-children class, even though they are not shown
-------------------------------------------------+-------------------------
Reporter: slobodanmanic | Owner:
Type: enhancement | Status: new
Priority: normal | Milestone: Future
Component: Menus | Release
Severity: normal | Version: 3.7
Keywords: good-first-bug needs-testing has- | Resolution:
patch | Focuses: ui
-------------------------------------------------+-------------------------
Changes (by iCaspar):
* keywords: needs-patch good-first-bug needs-testing => good-first-bug
needs-testing has-patch
Comment:
Here's the patch based on @kucrut's suggestion above. It seems that
removing the `.menu-item-has-children` route is the better one for two
reasons:
1. Seems more backwards-compatible, as themes won't have to update their
menu CSS to take into account the addition of a new class, and
2. Even though the menu item does have children in terms of the menu
walker, because the depth has been limited, they won't ever see the light
of day on the front end. At that point there's no use in having a CSS
class that says an item on the page has children when it doesn't.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/28620#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list