juanG-5
Fils de soutien créés au cours des 30 derniers jours : 0
Sujets de forum favoris
This user has no favorite topics.
Sujets de forum créés
Visualisation de 2 sujets : 1 à travers 2 (sur 2 au total)
| Status | Topic | Supporter | Voix | Publications | Nouveauté |
|---|---|---|---|---|---|
|
Visual design in search filters
Commencé par : juanG-5 in: Toolset Professional Support |
|
2 | 7 | Il y a 2 years | |
|
I want results view only displayed when clicking "submit"
Commencé par : juanG-5
in: Toolset Professional Support
Problem: Here's an example of an implementation:
/**
* 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( 123 ); // 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 );
|
|
2 | 2 | Il y a 2 years, 2 months |
Visualisation de 2 sujets : 1 à travers 2 (sur 2 au total)