谢谢你这么说。它没有任何深度。但你可能会发现什么。这是我在主题中找到的与“步行者”课程相关的内容。
如果我在浏览器中查看加载的代码,我会看到该子级的有一个“not click”类。
class smarthome_top_bar_walker extends Walker_Nav_Menu {
static protected $menu_bg_test;
function start_el(&$output, $item, $depth = 0, $args = Array(), $id = 0) {
$smarthome_class = "";
if(is_object($args)){
global $smarthome_count;
$icon=$item->classes[1];
if($item->mega_menu == 1) {
$smarthome_class= \'wd_mega-menu\';
}
$smarthome_icon = $item->mega_menu_icon ;
self::$menu_bg_test = $item->mega_menu_bg_image;
$indent = ($depth) ? str_repeat("\\t", $depth) : \'\';
$class_names = $value = \'\';
$classes = empty($item -> classes) ? array() : (array)$item -> classes;
$classes[] = ($item -> current) ? \'active\' : \'\';
$classes[] = ($args -> has_children) ? \' color-1 has-dropdown not-click\' : \'\';
$args -> link_before = (in_array(\'section\', $classes)) ? \'<label>\' : \'\';
$args -> link_after = (in_array(\'section\', $classes)) ? \'</label>\' : \'\';
$output .= (in_array(\'section\', $classes));
$class_names = ($args -> has_children) ? \'has-dropdown not-click \'.$smarthome_class : \'\';
$parent = $item -> menu_item_parent;
if ($parent == 0) {
$smarthome_count++;
}
$current_page = empty($item->classes[4]) ? \'\' : $item->classes[4];
$class_names .= \' color-\' . $smarthome_count .\' \'. $current_page ;
$class_names = strlen(trim($class_names)) > 0 ? \' class="\' . esc_attr($class_names) . \'"\' : \'\';
$output .= $indent . \'
<li id="menu-item-\' . $item -> ID . \'"\' . $value . $class_names . \'>\';
$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) ? \' href="\' . esc_url($item -> url) . \'"\' : \'\';
$attributes .= \' class="has-icon"\';
$item_output = $args -> before;
$item_output .= (!in_array(\'section\', $classes)) ? \'
<a\' . $attributes . \'>\' : \'\';
if(($icon != \'\') and ($icon != \'---- None ----\')) {
$item_output .= \'<i class="\'.$smarthome_icon.\' fa"></i> \';
}
$item_output .= $args -> link_before . apply_filters(\'the_title\', $item -> title, $item -> ID);
$item_output .= $args -> link_after;
$item_output .= (!in_array(\'section\', $classes)) ? \'</a>\' : \'\';
$item_output .= $args -> after;
$output .= apply_filters(\'walker_nav_menu_start_el\', $item_output, $item, $depth, $args);
}
}