Skip to content

Commit

Permalink
Updated so that drop downs get user defined menu item classes
Browse files Browse the repository at this point in the history
  • Loading branch information
jbuncle committed Apr 8, 2020
1 parent 80f8b63 commit 68852cd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/Four/WalkerNavMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ public function start_el(&$output, $item, $depth = 0, $args = [], $id = 0)
$classes[] = 'active';
}

$class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args, $depth));
$class_names = $class_names ? ' class="'.esc_attr($class_names).'"' : '';
$class_names_str = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args, $depth));
$class_names = $class_names_str ? ' class="'.esc_attr($class_names_str).'"' : '';

$id = apply_filters('nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args, $depth);
$id = $id ? ' id="'.esc_attr($id).'"' : '';
Expand All @@ -91,7 +91,7 @@ public function start_el(&$output, $item, $depth = 0, $args = [], $id = 0)
$atts['aria-expanded'] = 'false';
} else {
if (1 === $depth) {
$atts['class'] = 'dropdown-item';
$atts['class'] = $class_names_str . ' dropdown-item';
}
$atts['href'] = !empty($item->url) ? $item->url : '';
}
Expand Down

0 comments on commit 68852cd

Please sign in to comment.