I've got a category template: category-projects.php
This category has subcategories, but they're refering to the template category.php for instructions instead of the parent category. How do I make subcategories refer to parent category templates in the cascading order of template references?
*Note, I'm talking about category level urls, not posts.
One way to do this is to hook into the
template_redirect
action in yourfunctions.php
file:Richard's answer does work but it will heavily interfere with other plugins.
I found a better alternative using
add_filter
&template_include
as the example belowCredit to https://markjaquith.wordpress.com/2014/02/19/template_redirect-is-not-for-loading-templates/
As far i know; according to wp template hierarchy, category-samplecat.php is only applies to a category with slug name "samplecat". So it's not possible to do it in this way.
But in the category.php file (that applies to every category which hasn't a special template file) you can make a conditional check if current category is a child of "project" (using this method in my answer to your other question) and if so you can apply same structure of category-projects.php to it or include category-projects.php.