Saltar navegación

[Resuelto] How to set initial default dropdown View Output blank instead of All posts

This support ticket is created 4 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

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.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Zona horaria del colaborador: Asia/Kolkata (GMT+05:30)

Este tema contiene 17 respuestas, tiene 2 mensajes.

Última actualización por ClementB7865 4 years, 7 months ago.

Asistido por: Minesh.

Autor
Mensajes
#2206129

No items text is gone but I have the issue above. If a user does a search then puts the dropdowns back into default Select, hits refresh page, ALL shops appear...

#2206139

Minesh
Colaborador

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

I've again adjusted the code I've added to "Custom Code" section as given under:

add_filter( 'wpv_filter_query_post_process', 'prefix_modify_empty_query', 10, 3 );
function prefix_modify_empty_query( $query, $view_settings, $view_id ) {
      
     if(defined( 'DOING_AJAX') and DOING_AJAX ) {
      	foreach($_POST['search']['dps_general'] as $k=>$v):
      		if(
              	($v['name']=='wpv-wpcf-state' and $v['value']=='') 
              	or
                ($v['name']=='wpv-relationship-filter' and $v['value']==0)
             ){
            		 $query->posts = array(); // add the default post to the posts result array
      			  $query->found_posts = 0; // modify the count of found posts
        		$query->post_count = 0; // modify the count of displayed posts
            }
      	endforeach;
     } else if(isset($_GET['wpv_view_count'])) {
        		$query->posts = array(); // add the default post to the posts result array
      			 $query->found_posts = 0; // modify the count of found posts
        		$query->post_count = 0; // modify the count of displayed posts
     }
 
    
    return $query;
}

Do you see it working as expected now - even when you refresh the page?

#2206141

My issue is resolved now. Thank you so much Minesh!