Hi Amazing Toolset support,
I am creating a bigger and better local business directory. Which has an archive of businesses, attractions events and promotions.
I am using the filter by post type code provided by toolset. (https://toolset.com/forums/topic/filtersearch-by-custom-post-type/)
Here's me code:
add_filter( 'wpv_filter_query', 'post_type_filter_func', 10, 3 );
function post_type_filter_func( $query_args, $settings, $view_id ) {
if ( $view_id == 28 && isset($_GET['wpv-post-type'][0]) && !empty($_GET['wpv-post-type'][0]) ) {
$query_args['post_type'] = $_GET['wpv-post-type'][0];
}
return $query_args;
}
[wpv-filter-controls][wpml-string context="wpv-views"]Post Type:[/wpml-string] [wpv-control url_param="wpv-post-type" type="select" values=",post ,algarve-event ,algarve-promotion ,algarve-attraction ,live-algarve" display_values="All, Business, Event, Promotion, Attraction, Article"]
[wpv-filter-submit output="bootstrap"][/wpv-filter-controls]
1. Why does this code not seem to work on an archive as apposed to a view?
What is the tidiest way to make this an archive?
1, create a view and then display the view within the archive?
2, create a view and add it to a page and redirect the archive?
3, Any other suggestions
What is the link to your site?
hidden link
I look forward to hearing from you.
Thank you in advance, Matt