WordPress.org

Ready to get started?Download WordPress

Forums

How to have my lists only go one category deep? (1 post)

  1. buskerdog
    Member
    Posted 8 years ago #

    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?

    Thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags