Okay, yes, I agree about those 5 seconds and ongoing showing.
Second, yes, I need a solution, where we have in a first stage no result showing. And once the user is either choose something from the drop downs or use the text search, it will showing results according.
If You can help me with this wpv_filter_query API filter, would be great, I am not 100% familiar how to do that.
You can add this code to your site (at Toolset > Settings > Custom Codes), you should just need to edit the ID of the View:
/**
* No initial results
*
* Don't show View results until a filter has been applied
*
* Tests for custom field filters, taxonomy filters, or text searches
*/
function tssupp_no_initial_results( $query_results, $view_settings, $view_id ){
$target_views = array( 226 ); // Edit to add IDs of Views to add this to
if ( in_array( $view_id, $target_views ) ) {
// if there is a search term set
if ( !isset( $query_results->query['meta_query'] ) && !isset( $query_results->query['tax_query'] ) && !isset( $query_results->query['s'] ) ) {
$query_results->posts = array();
$query_results->post_count = 0;
$query_results->found_posts = 0;
}
}
return $query_results;
}
add_filter( 'wpv_filter_query_post_process', 'tssupp_no_initial_results', 10, 3 );
You will need to delete the text for "No items found" from the View.
I suspect when you added the code in the Toolset settings you didn't activate the code snippet?
There is little practical difference between adding the code in Toolset settings vs. editing your theme's functions.php file, except it is supposed to be more convenient ( 🙂 ) and means the code isn't lost if you change theme.
But the important thing is whether the code works, and it sounds like it does, yes?
Sorry it took a while to get to the solution, the other method should be simpler, but it can't work very easily with your View that has automatic pagination.