I'm trying to get a taxonomy archive template file to work, but with no luck. I think it might have to do with the fact that I declared a slug for the taxonomy like custom_post_type/taxonomy in order to keep the custom post type showing.
Here's how I register the custom post type and the custom taxonomy:
$args = array(
'labels' => $labels,
'query_var' => __('color', 'mydomain'),
'rewrite' => array(
'slug' => __('houses/color', 'mydomain'),
'with_front' => true
)
);
register_taxonomy('color', null, $args);
$args = array(
'labels' => $labels,
'public' => true,
'capability_type' => 'post',
'supports' => array('title', 'thumbnail', 'custom-fields'),
'has_archive' => true,
'taxonomies' => ['color'],
'rewrite' => array(
'slug' => __('houses', 'mydomain'),
'with_front' => true
)
);
register_post_type('house', $args);
My template file is called taxonomy-color.php and I expect it to be used when the pages /houses/color/red and /houses/color/green are visited.
Note: my actual custom post type name contains a dash, I don't know if it matters.