How to have my lists only go one category deep?
I am trying to create a category layout where the child categories for the category you are browsing are listed at the top and then the posts of the category you are browsing appear below. However, both of these components are showing the results for all child categories and not just the one level I want. Here’s the basic version of what I have:
<?php if ( is_category() ) : ?>
<?php wp_list_cats(“child_of=$cat&hide_empty=0”); ?>
<?php endif; ?>
<?php while (have_posts()) : the_post(); ?>
<?php the_content(”) ?>
<?php endwhile; ?>
However, all levels of subcats appear in the first part and all posts from all subcats appear in the second part. How do I limit the first part to one level of child cat and the second to only posts from the cat you are looking at?
- The topic ‘How to have my lists only go one category deep?’ is closed to new replies.