Problem:
Client wants to display a section only if a custom field that appears in that section is not empty. If there is no value the whole section should not be displayed.
Solution:
Use the wpv-conditional shortcode.
An example using a custom field with slug "sermons-audio" would be:
[wpv-conditional if="( NOT(empty($(wpcf-sermons-audio))) )"] <h4>Listen to the sermon</h4> <p>Some other conditional stuff</p> <p>Then the field itself</p> [types field="sermons-audio"][/types] [/wpv-conditional]
Relevant Documentation:
https://toolset.com/documentation/user-guides/conditional-html-output-in-views/checking-fields-and-other-elements-for-emptynon-empty-values/
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.
Our next available supporter will start replying to tickets in about 8.71 hours from now. Thank you for your understanding.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
This topic contains 8 replies, has 2 voices.
Last updated by 6 years, 7 months ago.
Assisted by: Nigel.