andrewhheller
Member
Posted 10 months ago #
Hello,
How can I hide child posts under a parent category? For example, if I click on a parent category archive I only want to see the posts from that parent category and hide all posts from child categories.
When I click on the child category archive I'd like to only see the posts from that child category.
Thanks,
- Andrew Heler
you will need to edit category.php (if your theme does not have a category.php, make a copy of archive.php and save it as category.php)
before the start of the loop, add a custom query;
example:
<?php global $wp_query;
$args = array_merge( $wp_query->query, array( 'category__in' => array(get_query_var('cat'))) );
query_posts( $args ); ?>
http://codex.wordpress.org/Function_Reference/query_posts#Usage_Note