Skip Navigation

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

This support ticket is created 3 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 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 17 replies, has 2 voices.

Last updated by ClementB7865 3 years, 7 months ago.

Assisted by: Minesh.

Author
Posts
#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
Supporter

Languages: English (English )

Timezone: 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!