Skip to content

Commit f07dde4

Browse files
authored
Merge pull request #370 from awesomemotive/issue/353-fixing-nav-menu-class-overriding
Fix overriding class value in nav menu links
2 parents 9b52068 + 406d22a commit f07dde4

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)