Home › Forums › Toolset Professional Support › [Resolved] Custom search shows all results before query is entered
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.
Tagged: Custom search, Views, Views plugin
This topic contains 2 replies, has 2 voices.
Last updated by chrisD-14 9 months, 3 weeks ago.
Assigned support staff: Waqar.
I have a custom search at hidden link
Before any search query has been entered, the search results show all products. I don't want anything to show up until a search query is entered. How can I achieve that?
English (English )
Thanks for asking! I'd be happy to help.
To make sure no results are shown from the view until a search term has been used, you can use conditional display block ( ref: https://toolset.com/documentation/user-guides/conditional-html-output-in-views/using-shortcodes-in-conditions/ ) to check the value of the "wpv_post_search" URL parameter, through the "wpv-search-term" shortcode ( ref: https://toolset.com/documentation/user-guides/views-shortcodes/#vf-214940 ).
You'll note that when a search term is used in the view, it is appended in the URL parameter "wpv_post_search".
To get its value following shortcode can be used:
This can be combined in a conditional block like this:
[wpv-conditional if="( '[wpv-search-term param="wpv_post_search"]' ne '' )"]
A search term exists
Likewise, this same conditional block can be used in the view's "Loop Editor" section, to wrap everything within the shortcodes "[wpv-layout-start]" and "[wpv-layout-end]".
I hope this helps and please let me know if you need any further assistance around this.
My issue is resolved now. Thank you!
Known issues and solutions
Frequently asked support questions
Support tickets archive
Get help from experienced contractors
Meet Toolset support team
Toolset Customer Support Policy
Need to tell us something about the quality of support
How to remove personal information from your database for support