only show post of the category
-
Is there any way to run a query to see if there are any posts when your in the last category? i.e
currently Accounts has sub categories but no posts in it
/accounts/ = /billing1/ + /finance/
Billing and finance have posts but don’t want them displayed in accounts
So what im trying to say is if there is posts in that category, show them don’t show post of your sub category’s
<?php $args = array( 'post_type' => 'st_kb', 'tax_query' => array( array( 'taxonomy' => 'st_kb_category', 'field' => 'slug', 'include_children' => false, 'terms' => $term_slug ) ), 'paged' => $paged ); $wp_query = new WP_Query($args); if($wp_query->have_posts()) : ?> <h3 id="category-title"><?php echo $st_term_data->name ?></h3> <?php while($wp_query->have_posts()) : $wp_query->the_post(); ?> <?php get_template_part( 'content-kb', get_post_format() ); ?> <?php endwhile; ?> <?php else : ?> <?php endif; ?> <?php wp_reset_postdata(); ?>
- The topic ‘only show post of the category’ is closed to new replies.