This support ticket is created Il y a 3 années et 1 mois. 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.
Aucun de nos assistants n'est disponible aujourd'hui sur le forum Jeu d'outils. Veuillez créer un ticket, et nous nous le traiterons dès notre prochaine connexion. Merci de votre compréhension.
I am trying to display text only if posts exist on my Leader pages.
Here is an example of one that has posts and works great: lien caché
Here is an example of one that doesn't have any posts and I'd like the words Featured In to not display: lien caché
While I'm asking, I'd also like to know if it's possible to change the checkboxes so that instead of being checkboxes, they are buttons. I'd like to make it so you just click on the word (Podcasts, Sermons, Video) instead of clicking checkboxes.
Les langues: Anglais (English )Espagnol (Español )
Fuseau horaire: Europe/London (GMT+00:00)
Because the Featured In text appears before the results of the View, if you wanted to use a Conditional block to only show the text if the View had results, you'd effectively need a separate duplicate View performing the same query (or a custom function performing that query) and you'd test whether that View (or custom function) had any results or not to determine whether to show the text.
Naturally, duplicating the query doesn't seem like a very efficient solution.
I think you can use a little trick with CSS instead.
Add some CSS that hides the text by default (you may want to add an ID in the block settings so that you can target it).
Then in the output section of the View add some more CSS that overrides the prior CSS and shows the hidden text.
You can use a custom HTML block to quickly add some CSS, e.g. where you add the Featured In text give that block an ID of, say, text-to-hide, then add a custom HTML block with the following:
Then in the output section add a similar custom HTML block that sets the display property to block.
As for the second question, Views doesn't offer any way to customise the appearance of such checkboxes. You can use CSS to essentially hide the native checkbox appearance and replace it with something like a button, say, there are lots of articles online about what is required to achieve something like that.