\n"; } function start_el( &$output, $item, $depth=0, $args=array(), $id=0 ) { global $wp; $indent = "- "; (strpos($item->title,"[dd-ph]") !== false) ? $is_dd_placeholder = true : $is_dd_placeholder = false; $indent = ( $depth ) ? str_repeat( "- ", $depth ) : ''; $class_names = $value = ''; // var_dump($item->title); $classes = empty( $item->classes ) ? array() : (array) $item->classes; if($is_dd_placeholder) $classes[] = 'dd-ph'; $classes[] = "depth".$depth; $classes_str = implode(" ",$classes); if(strpos($classes_str,"menu-item-has-children") !== false) { // if( $depth == 0 ) $classes[] .= ' dropdown'; } if( $depth == 1 && strpos($classes_str,"menu-item-has-children") !== false ) { // $classes[] = " dropdown-submenu"; // var_dump($css_class); // } $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item, $args ) ); $class_names = $class_names ? ' class="' . esc_attr( $class_names ) . '"' : ''; $id = apply_filters( 'nav_menu_item_id', 'menu-item-'. $item->ID, $item, $args ); $id = $id ? ' id="' . esc_attr( $id ) . '"' : ''; // $output .= $indent . ''; $atts = array(); $atts['title'] = ! empty( $item->attr_title ) ? $item->attr_title : ''; $atts['target'] = ! empty( $item->target ) ? $item->target : ''; $atts['rel'] = ! empty( $item->xfn ) ? $item->xfn : ''; $atts['href'] = ! empty( $item->url ) ? $item->url : ''; if( $is_dd_placeholder ) $atts['data-toggle'] = "dropdown"; if( $is_dd_placeholder ) $atts['class'] = 'dropdown-toggle'; /** * Filter the HTML attributes applied to a menu item's . * * @since 3.6.0 * * @param array $atts { * The HTML attributes applied to the menu item's , empty strings are ignored. * * @type string $title The title attribute. * @type string $target The target attribute. * @type string $rel The rel attribute. * @type string $href The href attribute. * } * @param object $item The current menu item. * @param array $args An array of arguments. @see wp_nav_menu() */ $atts = apply_filters( 'nav_menu_link_attributes', $atts, $item, $args ); $attributes = ''; foreach ( $atts as $attr => $value ) { if ( ! empty( $value ) ) { $value = ( 'href' === $attr ) ? esc_url( $value ) : esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } $item_output = $args->before; /* $item_output .= ''; if(strpos($classes_str,"fa_") !== false ) { foreach ($classes as $clas) { if(strpos($clas,"fa_") !== false) { $fa_name = str_replace("fa_","",$clas); $item_output .= ''; } } } */ /** This filter is documented in wp-includes/post-template.php */ /* $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after; $item_output .= ''; $item_output .= $args->after; */ $is_selected = ''; // $pg_url = get_bloginfo('wpurl').$_SERVER['REQUEST_URI']; // _eo-review: do we really need all these 3 ? Test with different permalinks and cut down to 1 var $current_u = add_query_arg( $wp->query_string, '', home_url( '/' . $wp->request ) ); $current_ur = home_url( '/' . $wp->request ) ; $current_url = trailingslashit(home_url( '/' . $wp->request ) ); if ( $current_u == $item->url || $current_ur == $item->url || $current_url == $item->url ) $is_selected = ' selected="selected"'; if ($is_dd_placeholder) { $rep_title = str_replace("[dd-ph]","",$item->title); $output .= "\n"; } else { $output .= ''; } $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args ); } } ?>