Skip to content

Commit 406d22a

Browse files
committed
Fix overriding class value in nav menu links
1 parent 9b52068 commit 406d22a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

inc/template-functions.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,12 @@ function botiga_nav_menu_css_class( $classes, $menu_item, $args, $depth ) {
4444
* @return array $atts Updated attributes for the li element.
4545
*/
4646
function botiga_nav_menu_link_attributes( $atts, $menu_item, $args, $depth ) {
47-
$atts[ 'class' ] = 'botiga-dropdown-link';
47+
if ( isset( $atts['class'] ) ) {
48+
$atts['class'] .= ' botiga-dropdown-link';
49+
} else {
50+
$atts['class'] = 'botiga-dropdown-link';
51+
}
52+
4853
return $atts;
4954
}
5055
add_filter( 'nav_menu_link_attributes', 'botiga_nav_menu_link_attributes', 10, 4 );

0 commit comments

Comments
 (0)