Tell us what you are trying to do?
I have a CPT with 80-100 Feilds for users to fill out if they apply to them. Most users will only fill out 2-5 of them. Rather than creating a view with a ton of conditionals - is there a way to loop through and simply display a Feild name and its value if the field has a value?
Just trying to create a simple unstyled printout type page.
Hello,
You can follow our document to setup the wpv-conditional shortcodes, check the custom field value isn't empty, then display the result:
https://toolset.com/documentation/legacy-features/views-plugin/checking-fields-and-other-elements-for-emptynon-empty-values/
Luo, thank you for the response. 100% understood on the conditional shortcodes from the legacy toolset types. That was my thinking at first and I would just create 80-100 conditional statements (one for each field).
The question here is if there is a way to create a loop that checks each field for a view if it has a value and display if it does. Would save time on writing 80-100 conditionals (one for each field to check if there is a value) but also would give some flexibility in the future for when we add in additional fields in the CPT so we would not have to go back and create more conditionals within the view.
An example would be a feature like a contact form builder where you have the option to insert a value like {all fields} for all answers that were filled out with a value into an email body.
My thought would be something like:
[wpv-items-found]
<wpv-loop>
[wpv-conditional if="( '[***Generic call for Field***][/types]' ne '' )"]
<p> ***Generic call for Field Title*** ***Field Value***</p>
[/wpv-conditional]
</wpv-loop>
[/wpv-items-found]
Possible within Toolset? Really the question would be if there is a way to check each field made within Custom Fields for a Post Type in a loop for a value - if yes then display.
Let me know your thoughts.
Unfortunately, there isn't such kind of built-in feature within Toolset plugins, you need to setup the shortcode [wpv-conditional] one by one for each custom field.
Thank you Lou - Would be a great feature to have, might tackle with some custom code in an array at some point in the future but for now I will stick with the legacy conditionals.
My issue is resolved now. Thank you!