Hello. Thank you for contacting the Toolset support.
Great to know that you chose Toolset to build your site.
There is no native feature available with Toolset Blocks using which you can filter your post based on post type. However, this is known feature to us and we already have in on our Development plan and this feature will be added in near future.
However, there is workaround and for that you need to create the view using classic view instead of blocks. To enable the classic view on your site, you need to follow the steps given with the following link:
=> https://toolset.com/2019/12/using-toolset-blocks-on-existing-toolset-sites/
[Please follow the section "Enable the new Blocks workflow"]
Once you set the above settings, you will see the "Views" as submenu under Toolset menu. Toolset => Views.
Now, you should create a custom search view from Toolset => Views => Add New.
1) edit your view, in section "Search and pagination", add a select dropdown for post type filters into your filter form:
[wpml-string context="wpv-views"]Post Type:[/wpml-string] [wpv-control url_param="wpv-post-type" type="select" values=",page,post" display_values="All,Page,Post"]
You can manually add more post type into it.
2) add below codes into your theme/functions.php:
or
You can add it to custom code section offered by Toolset:
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-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 == 9999 && isset($_GET['wpv-post-type'][0]) && !empty($_GET['wpv-post-type'][0]) ) {
$query_args['post_type'] = $_GET['wpv-post-type'][0];
}
return $query_args;
}
Where:
- Replace 9999 with your original View ID.
More info:
=> https://toolset.com/documentation/user-guides/views-filters/wpv_filter_query/
Please check the following related tickets that may help you:
=> https://toolset.com/forums/topic/creating-a-view-that-filters-by-post-type/
Please let me know if you need further hep.