Home › Toolset Professional Support › [Resolved] Hide publications in archives until a search filter 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 |
---|---|---|---|---|---|---|
- | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | 9:00 – 12:00 | - |
- | 13:00 – 18:00 | 13:00 – 18:00 | 13:00 – 18:00 | 14:00 – 18:00 | 13:00 – 18:00 | - |
Supporter timezone: America/Jamaica (GMT-05:00)
Tagged: Toolset Blocks, Views plugin
This topic contains 7 replies, has 2 voices.
Last updated by dominiqueM-3 4 years, 1 month ago.
Assisted by: Shane.
Hello,
Tell us what you are trying to do?
In an archive page, I would like that no post is displayed below the custom search form until a search is performed by a user.
In other words, when the archive page is loaded for the first time user should only see the search form.
Same thing when the user resets the search.
Thank you
Hi Dominique,
Thank you for getting in touch.
Can you let me know if you are building your custom search using the Gutenburg Block editor or are you using the classic views editor ?
Once you've let me know then I can go ahead and provide the instructions accordingly.
Thanks,
Shane
Hi Shane,
I made my custom search form and I built the archive loop by using Blocks.
Best regards
Hi Dominque,
Great in a case like this you will need to wrap your entire archive loop in a conditional block and using the advanced editor set the conditional to the following.
( ( '[wpv-search-term param='wpv_view_count' ]' ne '' ) )
Also see my screenshot for the advanced editor. Once you've done this, only when a search is performed will the results display. Otherwise it will be blank.
Please let me know if this helps.
Thanks,
Shane
Hi Shane,
Thank you for your reply.
It is working for the the first load of the archive: only the search form is displayed and after a search, a list of posts is displayed as a result.
But when I hit the reset search button I can still see all the posts below the search form.
Could it be possible to also hide the list of posts on reset?
Best regards
Hi Dominique,
We are going to have to check the filter against another URL parameter that is added. The main issue is because the "wpv_view_count" parameter is always there it is guaranteed to ensure that your results display.
However with the AJAX refresh the parameter isn't removed when you click the reset button. Is there another field that you can guarantee that the users will search for ?
We can use this instead since all the custom fields get removed from the URL when the reset button is clicked. If so can you let me have a look at the search page and I can provide the correct parameter to be used.
Thanks,
Shane
Shane,
In fact my project is still too drafty and I'm not sure if I should hide the list of posts yet.
From what you explain, a solution seems possible.
I would allow myself to reopen a question when the time comes.
Thank you again for your help.
Best regards
My issue is resolved now. Thank you!