if ( ! class_exists( 'Glm_Theme_Top_Bar_Walker' ) ) :
class Glm_Theme_Top_Bar_Walker extends Walker_Nav_Menu {
+
function display_element( $element, &$children_elements, $max_depth, $depth = 0, $args, &$output ) {
static $mainLevelCounter;
+ static $topbar_id_old;
+ $topbar_id = $args[0]->menu->term_id;
+
+ if ($topbar_id_old !== $topbar_id) {
+ $topbar_id_old = $topbar_id;
+ $mainLevelCounter = 0;
+ }
+
if ($depth == 0) {
++$mainLevelCounter;
}
$element->classes[] = ( $element->current || $element->current_item_ancestor ) ? 'active' : '';
$element->classes[] = ( $element->has_children && 1 !== $max_depth ) ? 'has-dropdown' : '';
$element->classes[] = ( $element->post_parent == 0 && $mainLevelCounter < 3 ) ? '' : 'drop-left';
- parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
+ parent::display_element( $element, $children_elements, $max_depth, $depth, $args, $output );
}
function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {
-// $topbar_id = $args->menu->term_id;
$item_html = '';
parent::start_el( $item_html, $object, $depth, $args );