Display level1 posts in a specific category
-
Hello
My structure is:
-Category(level1)
–Post1
–Post2
–Category2(level2)
—Post
—PostI want to show only the first level posts, i tried this code but it shows me all posts:
<?php $args = array( 'post_type' => 'knowledgebase', 'tax_query' => array( array( 'taxonomy' => 'knowledgebase_category', 'terms' => 31, 'hide_empty' => false, ), ), ); $catquery = new WP_Query( $args ); echo '<ul>'; while($catquery->have_posts()) : $catquery->the_post(); echo"<li> the_title(); echo "</li>"; endwhile; echo '</ul>'; ?>
Thank you
- The topic ‘Display level1 posts in a specific category’ is closed to new replies.