2012-04-19 75 views

回答

-1

不是你叫什麼.. 這增加了class="dropdown"到菜單的

// add a class 'dropdown' to menu items which have a sub menu 
add_filter('nav_menu_css_class', 'check_for_submenu', 10, 2); 
function check_for_submenu($classes, $item) 
{ 
    global $wpdb; 
    $has_children = $wpdb->get_var("SELECT COUNT(meta_id) FROM wp_postmeta WHERE meta_key='_menu_item_menu_item_parent' AND meta_value='" . $item->ID . "'"); 
    if ($has_children > 0) 
     array_push($classes, 'dropdown'); // add the class dropdown to the current list 
    return $classes; 
} 
+0

退房學步車類 – 2012-04-23 06:01:49

相關問題