Skip Navigation

[Resolved] Custom search – display results only if search field is not empty

This support ticket is created 2 years, 10 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 2 replies, has 1 voice.

Last updated by TomW5440 2 years, 10 months ago.

Assisted by: Waqar.

Author
Posts
#2345109

Tell us what you are trying to do?
I'm trying to create a custom search that only displays results if the search text field is not empty.

Is there any documentation that you are following? - This isn't covered in this document.
https://toolset.com/course-lesson/creating-a-custom-search/

So even if the search box is empty all the items are listed in view loop below. If text is added to search box it filters the results but I want to stop all the results appearing before search field is actually used.

I tried to achieve this by adding a conditional block and set it to:
NOT ( empty( '[wpv-search-term ]') )
e.g. Views Shortcode > Search term is NOT empty

This isn't working though. Can you please advise on how I can do this?
Thank you.

#2345163

I see now further down the support document it says how to do this.

So I added a conditional block and used the suggested shortcode -
( ( '[wpv-search-term param ='wpv_view_count'] ne '' ) )

This doesn't allow me to save the block it comes back with error "Please, complete all the conditions or remove them".

#2345169

I missed out a '
:-s