All\n"); $cats = $wpdb->get_results(" SELECT t.term_id, t.name, t.slug, x.parent FROM {$wpdb->prefix}term_taxonomy x JOIN {$wpdb->prefix}terms t ON x.term_id = t.term_id WHERE x.taxonomy = 'category' ORDER BY t.name "); foreach($cats as $cat) { if($cat->parent == 0) { print("\n"); } else { $parent = $wpdb->get_var(" SELECT t.slug FROM {$wpdb->prefix}terms t WHERE t.term_id = $cat->parent "); print("\n"); } } } function widget_drop_category($args) { extract($args); echo $before_widget; echo $before_title . 'Categories' . $after_title; ?>