Skip Navigation

[Resolved] I want the search page to show no results until a search is performed

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 1 reply, has 2 voices.

Last updated by Minesh 1 year, 5 months ago.

Assisted by: Minesh.

Author
Posts
#2623469

Jim

Tell us what you are trying to do?
I want the search page to show no results until a search is performed
Is there any documentation that you are following?
https://toolset.com/forums/topic/trying-to-load-page-without-initial-search-result/
Is there a similar example that we can see?
Not that I am aware of.
What is the link to your site?
hidden link

#2623535

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

As I understand, you do not want to display any results under yellow section until the search if performed. If that is true, you will require to use the view's filter hook: wpv_filter_query
- https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_query

For example:
- You can add the above code to "Custom Code" section offered by Toolset:
=> https://toolset.com/documentation/adding-custom-code/using-toolset-to-add-custom-code/

add_filter( 'wpv_filter_query', 'func_display_no_result_by_default', 10, 3 );
     function func_display_no_result_by_default( $query_args, $setting,$view_id ) {

    //// 4952 is your view ID, please adjust view ID if required
    if($view_id == 4952) {    
 
         if(!isset($_REQUEST['wpv_filter_submit'])) {
            $query_args['post__in'] = array(0);
        }
    }
    return $query_args;
}

Where:
- please adjust the filter code if required as per your requirement