Display Wordpress parent Category with their child category
- by saorabh
Hi,
I want to display only those the parent category which have some child category with their child category without using child_of=
I was trying to display but i am only able to get the list of child category not their parent category name.
<?php
$querystr = "SELECT wp_terms.name, wp_terms.term_id, wp_terms.name FROM wp_terms, wp_term_taxonomy WHERE wp_terms.term_id = wp_term_taxonomy.term_id AND wp_term_taxonomy.parent !=0 ";
$cat_child = $wpdb->get_results($querystr, OBJECT);
var_dump($cat_child);
foreach ($cat_child as $category) {
echo $category->name. ' , ';
}
?>
Help me..
Thanks