I don't know if this will help you where it looks like you are using a plugin to create custom post types and taxonomies (never had much like with those). This is what my developer did to get posts from a custom taxonomy to show up on a custom post page when the slugs match. Similar to what you're doing but technically in reverse...
In Functions.php...
Create custom post type to custom taxonomy relation
global $post_tax;
$post_tax = array(
'store' => array('post' => 'stores', 'tax' => 'store'),
'state' => array('post' => 'states', 'tax' => 'state')
);
Register post types
function post_types_custom_init() {
global $post_tax;
register_post_type($post_tax['store']['post'], array('label' => 'Stores','public' => true,'show_ui' => true,'_builtin' => false, 'capability_type' => 'post','hierarchical' => true,'rewrite' => array('slug' => 'stores'),'query_var' => true,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes')) );
register_post_type($post_tax['state']['post'], array('label' => 'States','public' => true,'show_ui' => true,'_builtin' => false, 'capability_type' => 'post','hierarchical' => true,'rewrite' => array('slug' => 'states'),'query_var' => true,'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes')) );
}
Hook into the init action and call create_post_type_taxonomies when it fires
add_action( 'init', 'create_beer_taxonomies', 0 );
Create taxonomies for their corresponding post types
function create_beer_taxonomies()
{
global $post_tax;
// Add new taxonomy
$labels = array(
'name' => _x( 'Stores', 'taxonomy general name' ),
'singular_name' => _x( 'Store', 'taxonomy singular name' ),
'search_items' => __( 'Search Stores' ),
'all_items' => __( 'All Stores' ),
'parent_item' => __( 'Parent Store' ),
'parent_item_colon' => __( 'Parent Store:' ),
'edit_item' => __( 'Edit Store' ),
'update_item' => __( 'Update Store' ),
'add_new_item' => __( 'Add New Store' ),
'new_item_name' => __( 'New Store Name' ),
);
// Make it hierarchical (like categories) and assign to specific post types
register_taxonomy($post_tax['store']['tax'],
array('post',$post_tax['review']['post']),
array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'stores-bp' ),
));
$labels = array(
'name' => _x( 'States', 'taxonomy general name' ),
'singular_name' => _x( 'State', 'taxonomy singular name' ),
'search_items' => __( 'Search States' ),
'all_items' => __( 'All States' ),
'parent_item' => __( 'Parent State' ),
'parent_item_colon' => __( 'Parent State:' ),
'edit_item' => __( 'Edit State' ),
'update_item' => __( 'Update State' ),
'add_new_item' => __( 'Add New State' ),
'new_item_name' => __( 'New State Name' ),
);
register_taxonomy($post_tax['state']['tax'],
array('post',$post_tax['beer']['review']),
array(
'hierarchical' => true,
'labels' => $labels,
'show_ui' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'states-bp' ),
));
}
In Template/Loop
function meta_loop_beers($queried_tax,$queried_term){
//$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$queried_page = get_query_var('paged');
$paged = $queried_page ? $queried_page : 1;
$post_type = '';
global $post_tax;
foreach($post_tax as $relation){
if( $relation['tax'] == $queried_tax ){
$post_type = $relation['post'];
break;
}
}
$args=array(
'post_type' => 'post',
$queried_tax => $queried_term,
'post_status' => 'publish',
'posts_per_page' => -1,
'caller_get_posts'=> 1
);
$my_query = null;
$my_query = new WP_Query($args);
<PUT LOOP(S) HERE>
wp_reset_query();
}
I believe* that is everything. You won't be able to copy-paste that code and get it working for you automatically but it will hopefully give you an idea as to how to get it to work. This was bleeding edge stuff at the time, completed about 6 months ago and I'm guessing there is a better implementation somewhere. Unfortunately, the site is still not live so nothing to show at the moment.
We also had to redirect (htaccess) those slugs for the taxonomies as we wanted those looking for the store (post type) and archive for the stores (taxonomy) to land on the same page where the 'profile page' of the store displayed both.
So the end result is that the archive page for domain.com/stores-bp/walmart will redirect to domain.com/stores/walmart.
Way too confusing! I can try to clarify where needed.