In Wordpress template chaining for categories, we have WP looking for:

category-slug.php → category-id.php → category.php → archive.php → index.php

Now, I'd like to make some tweaks in category.php, for instance insert some conditions over there, and if the condition is true, use a particular template (custom) otherwise continue processing the chain moving control as usual to archive.php

How can I achieve that? I guess I will have to create a category.php file in my child-theme folder, insert conditional statements, and? How shall I instruct WP to continue to process the template chain?


I faced a similar problem, answer is linked below, and it turns out Template Filters do the trick!


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.