You could do it in a more dynamic fashion, with a simple get var, or you could get complicated and create some rewrite rules to parse your own URLs.
Here’s a quick and simple GET var method –
Say you have a taxonomy term at:
example.com/alcohol-spirit-type/gin/
This would show posts of both post types associated with the taxonomy term.
Now append a variable on the end for each of your post types to create the URLs you’ll filter, like:
// change these to reflect the actual registered names of your post types
example.com/alcohol-spirit-type/gin/?my_filter=cocktail-recipe
and
example.com/alcohol-spirit-type/gin/?my_filter=distillery
Now add a bit of code to the theme’s functions.php
file to detect this appended variable and adjust the query accordingly:
function wpa54401_filter_pre_get_posts( $query ) {
if ( isset( $_GET['my_filter'] ) ) {
$query->set( 'post_type', array( $_GET['my_filter'] ) );
}
return $query;
}
add_filter( 'pre_get_posts', 'wpa54401_filter_pre_get_posts' );
Now visiting each of those URLs should give you only posts within each type.
EDIT-
Here’s a filter on taxonomy_template
to return custom templates for the two new views:
function wpa54401_custom_taxonomy_template( $template ) {
if ( isset( $_GET['my_filter'] ) ) {
$template = dirname( __FILE__ ) . '/tax-' . $_GET['my_filter'] . '.php';
}
return $template;
}
add_filter( "taxonomy_template", "wpa54401_custom_taxonomy_template" ) ;
the templates should be named tax-{your post type}.php