Show subcategories and hide posts or show posts if not exists subcategories
I would use a combination of get_categories and get_category_children to achieve this. For example: On the home page include something like this: <?php $args=array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’ ); $categories=get_categories($args); foreach($categories as $category) { $catChildren = get_term_by($category->ID, ‘category’); if(!empty($catChildren)) { echo ‘<h3><a href=www.yourwebsite.com/”‘ . $category->slug . ‘”>’ . $category->name . ‘</h3>’; } } … Read more