Is it possible to store WordPress Templates in “theme/template” instead of putting them in the main directory of the theme?

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?

Related posts

Leave a Reply

1 comment

  1. 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:

    taxonomy-{taxonomy}-{term}.php
    taxonomy-{taxonomy}.php
    

    … 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!