tc_location = $_location; add_filter( 'tc_nav_menu_css_class' , array($this, 'tc_add_bootstrap_classes'), 10, 4 ); } /** * hook : nav_menu_css_class */ function tc_add_bootstrap_classes($classes, $item, $args, $depth ) { //cast $classes into array $classes = (array)$classes; //check if $item is a dropdown ( a parent ) //this is_dropdown property has been added in the the display_element() override method if ( $item -> is_dropdown ) { if ( $depth === 0 && ! in_array( 'dropdown', $classes ) ) { $classes[] = 'dropdown'; } elseif ( $depth > 0 && ! in_array( 'dropdown-submenu', $classes ) ) { $classes[] = 'dropdown-submenu'; } } return $classes; } function start_lvl(&$output, $depth = 0, $args = array()) { $output .= "\n