custom-posts Custom Search
I have 2 views: 1 for the ‘search page’ above & 1 for the ‘results page’ below.
wpv-filter-search-box placeholder="Search" output="bootstrap"
Everything works well, but I cannot figure out how to systematically start with a ‘clean’ page with no results displayed (no posts) until the search is submitted. I would like to have no entries on the ‘results page’ 1) when the user lands on the page, 2) when the page is refreshed or 3) when the search is reset using the reset button.
I have looked at the documentation and tried a filter for blank page, but couldn't make it work.
I would very much appreciate you assistance on this. Thank you.
Hi Shane, that works fine thank you.
Do you have any experience about how to mange the 'No items found' text?
i.e. It is needed if there is a search with finds nothing, but not needed if a user hasn't submitted a text.
(I know it can be changed)
Thanks,
Hi Shane,
Thank you for your reply.
For a user who arrives on the page, but hasn't done a search, the page is 'fresh'. When the page is 'fresh' I would like the "no items found" not to show.
When a text is performed & nothing is found I would like the "no items found" to show as usual.
Thanks for your help.
There are 3 posibilities:
1. the user lands on the fresh search page and there is not a 'no items found' message. ??
2. the user performs a search and doesn't find anything, so there is a 'no itmes found' message. OK
3. the user performs a search and gets some results, so there is not a 'no items found' message. OK
Points 2 & 3 are fine, but is point 1. possible for a fresh page and/ or when the page is refreshed?
Thanks.
[wpv-conditional if="( '[wpv-search-term param='wpv_view_count']' ne '' )"]
no items found text can go here
[/wpv-conditional]
When a view search is triggered it adds the parameter "wpv_view_count" to the URL.
This conditional will pass for your scenarios
1. the user lands on the fresh search page and there is not a 'no items found' message. ??
A. If the user lands on the page fresh and there is no search performed then the "wpv_view_count" parameter won't be in the URL so this will fail the conditional because it only triggers when the url value is not empty.
2. the user performs a search and doesn't find anything, so there is a 'no itmes found' message. OK
A. This will cause the conditional to pass because once the search is performed then the 'wpv_view_count' parameter will get added to the url.
3. the user performs a search and gets some results, so there is not a 'no items found' message. OK
A. This section won't show because it is already preconditioned to when there is not items found.
NOTE: You must add the conditional within the [wpv-no-items-found] [/wpv-no-items-found] around the "No items found" text.
Hi Shane,
Thank you for the extra details.
I have implemented this and it does one of the two things.
For point 1A 'no items found' no longer shows on the fresh page, which is perfect.
For point 2A 'no items found' no longer shows, but it should - a search is submitted and there are no results found, so the user should see the 'no items found' message.
Does this mean that you can either have the message or you cannot?
When the page is fresh there should be no message.
When a results doesn't find anything the message should show.
Any further information would help.
Thank you for your assistance.
Hi Shane,
Yes that's fine, but I'll have to provide you access and won't be able unitl later
Before that, here is the code you provided with where i added it. there is pobably somehting wrong. What do yout think?
THanks,
Brilliant Shane. That does it.
It works exactly the way I had hoped thank you very much.
Please could you tell if the 'reset button' is only for clearing the search field OR if it is possible to clear the "not items found text" too?
Thank you.