Inicio › Toolset Professional Support › [Resuelto] Hide custom file upload field if empty
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10:00 – 13:00 | 10: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/Kolkata (GMT+05:30)
Etiquetado: Content Templates, Displaying post relationships, Views plugin
Documentación relacionada:
This topic contains 1 respuesta, has 2 mensajes.
Last updated by Minesh hace 7 años, 1 mes.
Assisted by: Minesh.
I am trying to hide a custom file upload field when empty. I've got a few other fields that don't display when empty but that is because I have a css style on it. This is the only way I knew how to do it, is there another way for these fields?
.speaker-article:empty, .speaker-videos:empty, .speaker-testimonials:empty, .presentation-pdf-link:empty { display: none!important; }
My .presentation-pdf-link:empty style isn't working though. The file upload field must work differently for when it's empty?
Currently my site is needing some fixes and style updates so is under maintenance but you can view the site with this temporary link - hidden link. Click on "Safety Speakers" and click on any speakers "Read More" button. Once the page refreshes, scroll down to the red "Presentation PDF" button. This is the button (that is the file upload custom field) that I do not wish to display if nothing has been uploaded to that speaker.
I found these two articles however neither really help me out as they are both older and trying to hide a label.
https://toolset.com/forums/topic/hiding-blank-or-empty-fields/
https://toolset.com/forums/topic/hide-labels-of-empty-custom-fields/
Hello. Thank you for contacting the Toolset support.
Well - you can use conditional HTML output. For example:
[wpv-conditional if="( NOT(empty($(wpcf-test-field))) )"] This field is not empty - so disply the button - button code goes here [/wpv-conditional]
More info:
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/
=> https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/