How do I display two separate taxonomy archives for two post types that share a single taxonomy?

According to the WordPress Codex

archive-{post_type}.php

So, in your case (depending on your naming):

archive-products.php

If you have a custom taxonomy archive also, then the challenge is structuring your archive to represent the proper taxonomy template.

If you need to have a custom taxonomy archive, I would recommend that you use the post-type archive structure above, and then within the archive file, determine the taxonomy that is being used, and load a template part.

Sample psuedo-code (on archive-products.php):

$tax = get_query_var( 'taxonomy' );
$term = get_query_var( 'term' );
if ($tax == 'your_taxonomy') {
    get_template_part('my_slug', 'my_name');
} else {
    // get the default template part...
}

Leave a Comment