Problem: I'm using wpv_filter_query_post_process to remove some posts from the results. I would like to hide the pagination when no results remain.
Solution: Use two filters in combination:
function tssupp_no_initial_results( $query_results, $view_settings, $view_id ){ $target_views = array( 572 ); // Insertar el ID de la view if ( in_array( $view_id, $target_views ) ) { // Si existe un filtro 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; add_filter( 'wpv_view_settings', 'ts_modify_rendered_view', 30, 2 ); } } return $query_results; } add_filter( 'wpv_filter_query_post_process', 'tssupp_no_initial_results', 10, 3 ); function ts_modify_rendered_view( $view_settings, $view_id ) { $view_settings['pagination']['type'] = 'disabled'; return $view_settings; }
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | 8:00 – 12:00 | - | - |
13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | 13:00 – 17:00 | - | - |
Supporter timezone: America/New_York (GMT-04:00)
This topic contains 5 respuestas, has 2 mensajes.
Last updated by juanC-8 hace 4 años, 10 meses.
Assisted by: Christian Cox.