Post not using taxonomy template
I do know that this question has been asked before, but I’m writing because the solutions I have found didn’t work.
So, I have a lot of posts with ‘post_type’ = ‘post’ that are filtered by a category taxonomy. The category taxonomy has some slugs that are hierarchical, while some of the others are not. I need to create a taxonomy template for each category.
So, for example, I have the following categories:
- Events
- Case Study (This has children categories such as Public, Health, etc) – All children will use the same template as the parent, in this case, the case study template
- Reports
Now, I’ve read on the documentation and on a lot of questions asked on stackexchange different ways of naming the taxonomy template file.
I’ve tried most of the naming of files including the following:
- taxonomy-category-{slug}.php
- taxonomy-category.php
- category-{slug}.php
- category-{ID}.php
- taxonomy.php
The post still uses the index.php template to display the post instead of any of the taxonomy created files.
In the wp_term_taxonomy table, I noticed the existence of multiple taxonomies with the same name (in this case category), all with a different ID, of course. The count on them is different, but adding all of them together don’t add up to the amount of posts that I currently have. I’m not sure if this might be the issue (Maybe it doesn’t know which taxonomy to use when there are multiple ones).
Anyone has any suggestions regarding this?
Leave an answer