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
Done by doing this
Thank you
If you don't want to use "child_of" argument then your problem can be solved by using two loops one for displaying parent categories and other for displaying its direct child categories.