Projects <-contains basic info about projects
-Proj1 <-detailed info about proj1
-Proj2 <-detailed info about proj2
-Proj3 <-detailed info about proj3
I have a post attributed to the parent category ‘Projects’, and I want only that post to be seen when ‘Projects’ is clicked. By default, each of the subcategories’ posts are being shown when I click ‘Projects.’ Is there a way to change this default setting, so that no posts from subcategories ‘Proj1,’ ‘Proj2,’ and ‘Proj3’ are seen in ‘Projects’?
I was referred to a plugin called Cat Lists Plus, but this completely eliminates the parent category link. (This has also not been released yet.)
You can alter the posts query by using the
pre_get_posts
filter, and passing the parametercategory__in
.In order to do that, put the following code in your theme’s functions.php: