Here is my issue: I have one parent category with many sub-categories below it, e.g.
Category
Sub category
sub-sub category......
sub-sub category......
sub-sub category......
sub-sub category......
sub-sub category......
........
I used the WP dTree plugin to show the categories as a tree. Now I want that when I click any sub-sub category......
that it shows all the posts in that category in one custom post template.
I know how to make post template and I know when I make any post if the template file is defined the post will show that template. However I have a lot of "sub-sub category......"
categories which contain many posts so it’s hard to always define template for each post.
If there’s any way to display all the posts in a sub-sub category......
category in one custom template, then please share with me…
Below is an example of what I’m trying to do:
show all post in their parent category may be work?
Here is what i do, first i add this function to my theme’s functions.php file:
then i create a function to select the correct template based on the parent category which i hook to the
single_template
hook ex:Mind the
$cats_templates
array which is where you define a template X for posts under category Y.