item_spacing)) { $t = ($args->item_spacing === 'discard') ? '' : "\t"; $indent = str_repeat($t, $depth); } else { $indent = str_repeat("\t", $depth); } $classes = array('sub-menu'); $class_names = join(' ', apply_filters('nav_menu_submenu_css_class', $classes, $args, $depth)); $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : ''; $output .= "\n$indent\n"; } // Start Element function start_el(&$output, $item, $depth = 0, $args = null, $id = 0) { if (isset($args->item_spacing)) { $t = ($args->item_spacing === 'discard') ? '' : "\t"; $indent = str_repeat($t, $depth); } else { $indent = str_repeat("\t", $depth); } $classes = empty($item->classes) ? array() : (array) $item->classes; $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args, $depth)); $class_names = $class_names ? ' class="' . esc_attr($class_names) . '"' : ''; $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 : ''; $atts['class'] = 'menu-link'; $atts['class'] .= $depth > 0 ? ' submenu-link' : ''; $attributes = ''; foreach ( $atts as $attr => $value ) { if ( ! empty( $value ) ) { $value = esc_attr( $value ); $attributes .= ' ' . $attr . '="' . $value . '"'; } } // Ensure $args is an object and has the required properties $before = isset($args->before) ? $args->before : ''; $link_before = isset($args->link_before) ? $args->link_before : ''; $link_after = isset($args->link_after) ? $args->link_after : ''; $after = isset($args->after) ? $args->after : ''; $title = apply_filters('the_title', $item->title, $item->ID); $item_output = $before; $item_output .= ''; $item_output .= $link_before . $title . $link_after; $item_output .= ''; $item_output .= $after; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args, $id); } } } ?>