\n";
}
function start_el( &$output, $item, $depth, $args ) {
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
$class_names = $value = '';
// var_dump($item->title);
$classes = empty( $item->classes ) ? array() : (array) $item->classes;
(strpos($item->title,"[dd-placeholder]") !== false) ? $is_dd_placeholder = true : $is_dd_placeholder = false;
if($is_dd_placeholder) $classes[] = 'dd-placeholder';
$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 .= '';
/** 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;
if( $is_dd_placeholder) $item_output = str_replace("[dd-placeholder]","",$item_output);
$output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );
}
}
?>