Opened 11 years ago
Closed 11 years ago
#24644 closed enhancement (duplicate)
Add "parent" class to menu items with sub-menus
Reported by: | Looimaster | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Menus | Keywords: | |
Focuses: | Cc: |
Description
Currently there is no way to indicate that a menu has sub-menu (by inserting an arrow pointing downwards next to parent menu item) without custom menu walker or filters that will add 'parent' class to menu items that have sub-menus.
It would be great if that could become a default class in WordPress.
function add_parent_css( $classes, $item ) { global $dd_children; if( $dd_children ) { $classes[] = 'parent'; } return $classes; } add_filter( 'nav_menu_css_class', 'add_parent_css', 10, 2 );
Change History (2)
Note: See
TracTickets for help on using
tickets.
And here's the rest of the walker (can't update my original suggestion):
The reason I'm asking this is because plugins such as WPML add 'language switcher' as menu item and they ignore custom walker. Instead of chasing plugin authors and dropping them suggestions this could be a default feature of WordPress.