Skip Navigation

[Resolved] Creating conditional output

This support ticket is created 5 years, 2 months ago. 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.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 1 reply, has 2 voices.

Last updated by Beda 5 years, 2 months ago.

Assisted by: Beda.

Author
Posts
#1374813

I'm setting up a view that will show custom fields from a taxonomy (term field). If they have not uploaded a headshot, I don't want it to output.

When I try to use the conditional output generator, the custom fields aren't showing up as an option.

The term field slug is termmeta='headshot-instructor' - what's my conditional shortcode?

(ie if it was a post custom field with the slug "head-shot" the code would be : [wpv-conditional if="( $(wpcf-head-shot) ne '' )"]

#1374841

Something like this should work:

[wpv-conditional if="( '[wpv-taxonomy-field name="wpcf-a-term-field"]' ne '' )"]YES[/wpv-conditional]

Or also:

[wpv-conditional if="( '[types termmeta='a-term-field'][/types]' ne '' )"]YES[/wpv-conditional]

However, thank you for asking us this question, because it's not OK in my opinion that you have to guess.
It should be possible to create such conditionals with the GUI or at least have a DOC that elaborates on it.

Hence I'll escalate this as a usability issue and improvement to make.
You can either mark this ticket as resolved if above solution works for you, or keep it open so I can update you on the progress made.
It's by the way not the first time that this issue pops up, I see in the forum:
https://toolset.com/forums/topic/conditional-display-using-taxonomy-term-fields/
https://toolset.com/forums/topic/how-to-conditional-display-taxonomy-term-fields-in-taxonomy-archive/
Note that in the last above ticket Christian suggests what you tried initially, but for me, that did not work. So I don't think that is supported, instead you'll need to use either of my suggested approaches above.
I will also check if this is really not supported or just a BUG (the $(wpcf-etc) syntax)

Thanks again!