I have a post type called Manufacturers and another called Reps
both are related many-to-many with an intermediary post type.
in one of my views I have a "manufacturer's index" which is a simple list of Manufacturers, and under each manufacturer is it's related reps. here's the view on the front end: hidden link
I accomplish this by first making a view that lists the manufacturers. then, inside the loop of that view, i have another view that lists all reps associated with the manufacturer in the current loop.
here's the loop:
<div style="font-size: 1.4em;">[wpv-post-title]</div>
<div>[wpv-view name="related-reps"]</div>
This works fine. However, I want to hide manufacturer's that do not have any published reps associated with them.
I think I can do this with php and toolset_get_related_posts if I can filter the query results
to filter the query results, I thought I would be able to use wpv_filter_query
however, when I use this simple wpv_filter_query, it stopes the nested view from working, and i only end up with a list of manufacturers:
function filter_manufacturers_lacking_reps($query_args,$view_settings,$view_id){
if ($view_id == 443){ //only apply to the manufacturer's index view
return $query_args;
}
}
add_filter( 'wpv_filter_query', 'filter_manufacturers_lacking_reps', 99, 3 );
is there a reason that this filter stops nested views? is there something I can do to prevent it? or can i filter the query results in another way?