A site I work on has a ton of different templates. I’m just trying to keep things organized. I’d like to put all the non-standard templates (IE not single.php, page.php, etc) into their own directory.
Is this common? Doable?
A site I work on has a ton of different templates. I’m just trying to keep things organized. I’d like to put all the non-standard templates (IE not single.php, page.php, etc) into their own directory.
Is this common? Doable?
You must be logged in to post a comment.
Yep, I believe it’s possible. According to this post by Andrew Nacin, WordPress will look for template files in the root folder of the theme and in any (single) subfolder that is one level deep.
So, for example, let’s say you have a ton of taxonomy template files like:
… And they’re cluttering up your root folder of your theme… You can just throw them into a subfolder (the name shouldn’t matter) such as
templates_taxonomies/taxonomy-{taxonomy}.php
and WordPress should pick them up.I haven’t tested it though, so let me know if it works, I’d be curious to do that myself!
Have fun!