/** * default_menu_item */ function default_menu_item(&$output, $args, $item, $depth) { global $mega_main_menu; $args = (object) $args; $item = (object) $item; $indent = str_repeat("\t", $depth); $class_names = $value = ''; $classes = empty($item->classes) ? array() : (array) $item->classes; $classes[] = 'menu-item-' . $item->ID; $class_names = join(' ', apply_filters('nav_menu_css_class', array_filter($classes), $item, $args)); $args->_submenu_type = substr_count($args->_submenu_type, $mega_main_menu->constant['MM_WARE_PREFIX'] . '_menu_widgets_area_') == 1 ? 'widgets_dropdown' : $args->_submenu_type; $args->_submenu_type = $args->_submenu_type == 'post_type_dropdown_multisite' ? 'post_type_dropdown' : $args->_submenu_type; $class_names .= ' ' . implode(' ', array($args->_submenu_type, $args->_item_style, $args->_submenu_drops_side, $args->_submenu_enable_full_width, 'columns' . $args->_submenu_columns)); $_pull_to_other_side = get_post_meta($item->ID, $mega_main_menu->constant['MM_WARE_PREFIX'] . '_pull_to_other_side', true); $class_names .= is_array($_pull_to_other_side) && in_array('true', $_pull_to_other_side) ? ' pull_to_other_side' : ''; $class_names = str_replace(' dropdown ', ' ', $class_names); $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) . '"' : ''; if (get_post_meta($args->menu_item_parent, $mega_main_menu->constant['MM_WARE_PREFIX'] . '_submenu_type', true) == 'multicolumn_dropdown') { $columns = get_post_meta($args->menu_item_parent, $mega_main_menu->constant['MM_WARE_PREFIX'] . '_submenu_columns', true) ? get_post_meta($args->menu_item_parent, $mega_main_menu->constant['MM_WARE_PREFIX'] . '_submenu_columns', true) : 1; $item_width = ' style="width:' . 100 / $columns . '%;"'; } else { $item_width = ''; } $output .= mm_common::ntab($depth) . '<li' . $id . $value . $class_names . $item_width . '>'; $_disable_text = get_post_meta($item->ID, $mega_main_menu->constant['MM_WARE_PREFIX'] . '_disable_text', true); $link_class = is_array($_disable_text) && in_array('true', $_disable_text) ? ' menu_item_without_text' : ''; // $link_before = '<span>' . $args->link_before; // $link_after = $args->link_after . '</span>'; $item->icon = get_post_meta($item->ID, $mega_main_menu->constant['MM_WARE_PREFIX'] . '_item_icon', true) ? get_post_meta($item->ID, $mega_main_menu->constant['MM_WARE_PREFIX'] . '_item_icon', true) : ''; $item->descr = get_post_meta($item->ID, $mega_main_menu->constant['MM_WARE_PREFIX'] . '_item_descr', true); // $_disable_icon = ( empty( $item->icon ) ? true : false ); $_disable_link = is_array(get_post_meta($item->ID, $mega_main_menu->constant['MM_WARE_PREFIX'] . '_disable_link', true)) && in_array('true', get_post_meta($item->ID, $mega_main_menu->constant['MM_WARE_PREFIX'] . '_disable_link', true)) ? true : false; $link_class .= empty($item->icon) ? ' disable_icon' : ' with_icon'; $item_icon = '<i class="' . $item->icon . '"></i> '; $attributes = !empty($item->attr_title) ? ' title="' . esc_attr($item->attr_title) . '"' : ''; $attributes .= !empty($item->target) ? ' target="' . esc_attr($item->target) . '"' : ''; $attributes .= !empty($item->xfn) ? ' rel="' . esc_attr($item->xfn) . '"' : ''; $attributes .= !empty($item->url) && $_disable_link !== true ? ' href="' . esc_attr(do_shortcode($item->url)) . '"' : ''; $attributes .= !empty($link_class) ? ' class="item_link ' . $link_class . '"' : ''; $first_number_of_index = 0; $tabindex = mm_common::script_id('mmm_tabindex'); $item_output = ''; // $item_output .= $args->before; $item_output .= mm_common::ntab($depth + 1) . '<' . ($_disable_link !== true ? 'a' : 'span') . $attributes . ' tabindex="' . $tabindex . '">'; $item_output .= mm_common::ntab($depth + 2) . $item_icon; // $item_output .= $link_before; $item_output .= mm_common::ntab($depth + 2) . '<span class="link_content">'; $item_output .= mm_common::ntab($depth + 3) . '<span class="link_text">'; $item_output .= mm_common::ntab($depth + 4) . do_shortcode(apply_filters('the_title', $item->title, $item->ID)); if (!empty($item->descr)) { $item_output .= mm_common::ntab($depth + 4) . '<span class="link_descr">'; $item_output .= do_shortcode(mm_common::excerpt($item->descr)); $item_output .= mm_common::ntab($depth + 4) . '</span>'; } $item_output .= mm_common::ntab($depth + 3) . '</span>'; $item_output .= mm_common::ntab($depth + 2) . '</span>'; // $item_output .= '<span class="link_text">' . apply_filters( 'the_title', $item->title, $item->ID ) . '</span>'; // $item_output .= $link_after; $item_output .= mm_common::ntab($depth + 1) . '</' . ($_disable_link !== true ? 'a' : 'span') . '>'; // $item_output .= $args->after; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); }