I am trying to: display a li only if it is not empty
I used this code:
[wpv-conditional if="( NOT(empty($(wpcf-bijlage))) )"]
[icon name="download" class="" unprefixed_class=""] <a href="[types field="bijlage" link="true" output="raw"][/types]">[types field="publicatietitel"][/types]</a>
[/wpv-conditional]
I expected to see: a download link if the field is not empty
Instead, I got: nothing; the download link doesn't show at all.
What am I doing wrong?
Thank you for contacting us here in the Support Forum
With the below code you check if the Custom Field "Bijlage" is NOT empty:
[wpv-conditional if="( NOT(empty($(wpcf-bijlage))) )"]
This field is not empty
[/wpv-conditional]
Now, if you use this in a View or on a Single Post, it will check the current Post, and if the Field is NOT empty, it will display things, if it is empty, not.
Can you tell me what sort of Field "Bijlage" is?
Perhaps you can try to remove your conditional and then add in the Views Loop NO conditional but only your list:
<li>
[icon name="download" class="" unprefixed_class=""]
<a href="[types field='bijlage' link='true' output='raw'][/types]">[types field="publicatietitel"][/types]</a></li>
Does it even display something (if the Field is not empty)?
If yes, now highlight that code and hit ion the Button "Conditional Output" in the Views editor and set your conditions with the wizard.
That should work.
Please don't hesitate to inform me in case the issue persists
Thank you for your patience.
The field "bijlage" is an attachment upload field. I guess that's why it didn't work; no problem with a regular text field. I used a second field with the title of the attached file in a text field instead of the attachment field and used this as a conditional. Now it works fine.