function start_el(&$output, $item, $depth = 0, $args = array(), $id = 0) { $class_names = ''; $value = ''; $indent = $depth ? str_repeat("\t", $depth) : ''; $classes = empty($item->classes) ? array() : $item->classes; $classes[] = 'menu-item-' . $item->ID; // adding depth class $classes[] = 'depth-' . $depth; //adding if link is disabled $classes[] = !empty($item->column_title_link) ? 'no-link' : ''; // adding if mega menu class $classes[] = $depth == 0 && !empty($item->mega) ? 'mega-menu' : ''; // adding if full-width class $classes[] = $depth == 0 && !empty($item->mega) && $item->mega_width == 'full-width' ? 'col-' . $this->child_count . ' ' . $item->mega_width : ''; // adding if natural-width class $classes[] = $depth == 0 && !empty($item->mega) && $item->mega_width == 'natural' ? 'col-' . $this->child_count . ' ' . $item->mega_width : ''; // adding if custom-width class $classes[] = $depth == 0 && !empty($item->mega) && $item->mega_width == 'custom' ? '' . $item->mega_width : ''; // adding if right position class $classes[] = $depth == 0 && !empty($item->mega) && !empty($item->mega_width) && !empty($item->mega_position) ? 'right' : ''; // adding bootstrap col if parent item is mega! if ($depth == 1 && isset($this->menu_type[$item->menu_item_parent])) { $bs_col = create_get_bootstrap($this->child_count); } $classes['col'] = !empty($bs_col) ? $bs_col : ''; // adding force custom boostrap col $classes['col'] = $depth == 1 && !empty($item->column_width) ? $item->column_width : $classes['col']; $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 . '<li' . $id . $value . $class_names . '>'; $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 = 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; // if column title link not disable if (empty($item->column_title_link)) { $create_hover_effect = ""; $is_mega_column = isset($this->menu_type[$item->menu_item_parent]) ? ' title' : ''; $item_output .= '<a' . $attributes . ' class="link link-depth-' . $depth . $is_mega_column . '">'; } else { if ($depth == 1 && !empty($item->column_title_link)) { $item_output .= '<a class="link title column-title">' . $item->colum_title; } } // adding icon $item_output .= !empty($item->icon) ? '<i class="' . create_icon_class($item->icon) . '"></i>' : ''; // if column title not disable if (empty($item->column_title)) { $item_output .= $args->link_before . '<span>' . apply_filters('the_title', $item->title, $item->ID) . '</span>' . $args->link_after; } // if column title link not disable if (empty($item->column_title_link) || $depth == 1 && !empty($item->column_title_link)) { $item_output .= '</a>'; } $item_output .= $args->after; $output .= apply_filters('walker_nav_menu_start_el', $item_output, $item, $depth, $args); }
/** * * Menu Fields * @since 1.0.0 * @version 1.0.0 * */ public function create_mega_menu_fields($item_id, $item) { ?> <div class="field-icon description description-wide"> <?php $hidden = empty($item->icon) ? ' hidden' : ''; $icon = !empty($item->icon) ? ' class="' . create_icon_class($item->icon) . '"' : ''; ?> <div class="create_field create_field_icon"> <div class="icon-select"> <span class="button icon-picker <?php echo $item->icon; ?> "><?php _e(" Icon", 'create'); ?> </span> <input type="hidden" name="menu-item-icon[<?php echo $item_id; ?> ]" value="<?php echo $item->icon; ?> " class="widefat code edit-menu-item-icon icon-value"/> </div> </div> </div> <div class="mega-menu"> <div class="field-mega"> <label for="edit-menu-item-mega-<?php echo $item_id; ?> "> <input type="checkbox" class="is-mega" id="edit-menu-item-mega-<?php echo $item_id; ?> " value="mega" name="menu-item-mega[<?php echo $item_id; ?> ]"<?php checked($item->mega, 'mega'); ?> /> <?php _e("Mega Menu", 'create'); ?> </label> </div> <div class="field-mega-width"> <select id="edit-menu-item-mega_width-<?php echo $item_id; ?> " name="menu-item-mega_width[<?php echo $item_id; ?> ]" class="is-width"> <option value="full-width"><?php _e("Full Width", 'create'); ?> </option> <?php $mega_width = array('natural' => 'Auto Width', 'custom' => 'Custom Width'); foreach ($mega_width as $key => $value) { echo '<option value="' . $key . '"' . selected($key, $item->mega_width) . '>' . $value . '</option>'; } ?> </select> </div> <div class="mega-depend-width hidden"> <p class="description"> <label for="edit-menu-item-mega_custom_width<?php echo $item_id; ?> "> <?php _e("Custom Width (without px)", 'create'); ?> <br /> <input type="text" id="edit-menu-item-mega_custom_width<?php echo $item_id; ?> " class="widefat code edit-menu-item-mega_custom_width" name="menu-item-mega_custom_width[<?php echo $item_id; ?> ]" value="<?php echo esc_attr($item->mega_custom_width); ?> " /> </label> </p> </div> <div class="mega-depend-position hidden"> <p class="description"> <label for="edit-menu-item-mega_position<?php echo $item_id; ?> "> <input type="checkbox" id="edit-menu-item-mega_position<?php echo $item_id; ?> " value="1" name="menu-item-mega_position[<?php echo $item_id; ?> ]"<?php checked($item->mega_position, 1); ?> /> <?php _e("Align Right", 'create'); ?> </label> </p> </div> <div class="clear"></div> </div> <div class=""> <p class="field-column description description-thin"> <label for="edit-menu-item-column-title-<?php echo $item_id; ?> "> <input type="checkbox" id="edit-menu-item-column-title-<?php echo $item_id; ?> " value="1" name="menu-item-column_title[<?php echo $item_id; ?> ]"<?php checked($item->column_title, 1); ?> /> <?php _e("Disable Title Text", 'create'); ?> </label> </p> <p class="field-column description description-thin last"> <label for="edit-menu-item-column-title-link-<?php echo $item_id; ?> "> <input type="checkbox" id="edit-menu-item-column-title-link-<?php echo $item_id; ?> " value="1" name="menu-item-column_title_link[<?php echo $item_id; ?> ]"<?php checked($item->column_title_link, 1); ?> /> <?php _e("Disable Link", 'create'); ?> </label> </p> <div class="clear"></div> </div> <div class="clear"></div> <?php }