In my most recent project, I’m dealing with a website that included dozens of custom taxonomies, couple of post types, content, etc. and required different templates for different authors or tags.
Right now, my template folder has about 70 php files for templates, which is really confusing.
I noticed that some themes such as twentyseven manage to store template files in folders and call them in a loop as the following:
get_template_part( 'template-parts/post/content', get_post_format() );
But this is in the loop. My templates are entirely different so i can’t use the above solution, because i will need to use conditionals for altering anything that is not part of the loop.
For example, if i have 3 post types, i have to save 3 template files:
These templates are entirely different, both in or outside the loop, so i can’t just make a
single.php and call the appropriate post type in the loop.
Is there anyway to address WordPress about custom template files other than just saving it directly inside the theme’s folder?