Inicio › Toolset Professional Support › [Resuelto] hide search view if there is not search results and display another element
Problem:
I'm trying to design a page with a view that will display the users with all their posts. however if the use never publish a post before i want to hide the view and display a button to create their first post.
Solution:
You can try these:
Relevant Documentation:
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.
Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.
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/Hong_Kong (GMT+08:00)
Este tema contiene 4 respuestas, tiene 2 mensajes.
Última actualización por davidZ-4 hace 3 años, 5 meses.
Asistido por: Luo Yang.
Tell us what you are trying to do? hide search view if there is not search results and display another element.
the site allow users to publish their own custom posts.
I'm trying to design a page with a view that will display the users with all their posts. however if the use never publish a post before i want to hide the view and display a button to create their first post.
Is there any documentation that you are following?
https://toolset.com/documentation/programmer-reference/views-filters/
https://toolset.com/documentation/programmer-reference/views-api/
Is there a similar example that we can see?
I have done before using the toolset legacy view plugin. I used toolset conditional element to display a button if the the search results are empty.
With the new view block I'm not sure how to do this.
What is the link to your site?
enlace oculto
Hello,
I assume you are using WordPress blocks editor, and we are talking about View block, if it is, please try these:
1) Find and select "View Loop" block, in section "Loop Template", input box "No Items Found Text", there you can setup the Button HTML codes you wanted, see my screenshot no-item.JPG
2) If you want to hide entire search result element, you can setup CSS codes into input box "No Items Found Text", for example:
<style> .js-wpv-view-layout{ display:none; } </style>
Hi Luo,
Thanks for this, its partially answer my question.
allow me to elaborate on the scenario:
user register to the site, and never submit a custom post.
to submit a post user can go to "my custom posts" page that have a view that search and display all custom posts user publish.
however as the user never submit custom post the view should be hidden and a button to create a post display.
I hope we can hide the search criteria as well as no post are available.
I remember building this with the old view and I wonder if this can be replicated with the new view block.
Please advise,
Thanks,
David
Unfortunately, there isn't such kind of built-in feature within Toolset Blocks plugin, you might consider to hide the custom search form with CSS codes too, see my answer above:
https://toolset.com/forums/topic/hide-search-view-if-there-is-not-search-results-and-display-another-element/#post-2076851
My issue is resolved now. Thank you!