I'm wondering if the following setup can be more efficient without creating an taxonomy term page for every custom taxonomy term.
I'm working with courses (CPT) which has it's own taxonomy (Course type).
Right now I have an archive template that lists all CPT by their taxonomy. I also have multiple taxonomy term templates for every taxonomy term like:
- taxonomy-course-type-english.php
- taxonomy-course-type-french.php
- taxonomy-course-type-spanish.php
These template files uses a wp_query loop to show every post in the given taxonomy term. For example:
<?php $args = array(
'posts_per_page' => -1,
'post_type' => 'courses',
'orderby' => 'date',
'tax_query' => array(
array(
'taxonomy' => 'course-type',
'field' => 'slug',
'terms' => 'french',
),
),
);
The taxonomy-course-type.php template file list all posts from the taxonomy when using the default loop.
Isn't there a way to use the taxonomy-course-type.php template file instead of the taxonomy terms pages where you have to create a new template file for every newly added taxonomy term?