Greetings,
For some reason I need to add extra class to the menu item link, but the problem is:
The theme override the filter nav_menu_link_attributes
The problem:
In the file inc/modules/mega-menu-walker/class-mega-menu-walker.php:402
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
$atts['class'] = 'woodmart-nav-link';
The theme will remove any class added by the filter and it will replace it with woodmart-nav-link
The correct code should be:
$atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args, $depth );
if ( array_key_exists( 'class', $atts ) ) {
$atts['class'] .= ' woodmart-nav-link';
} else {
$atts['class'] = 'woodmart-nav-link';
}
Sincerely,
Mohammed
-
This topic was modified 7 hours, 33 minutes ago by
maloneweb.
-
This topic was modified 7 hours, 32 minutes ago by
maloneweb.