Skip Navigation

[Resolved] Changing the output of checkboxes – revisited

This thread is resolved. Here is a description of the problem and solution.

The customer asked how to properly add a conditional statement for a checkboxes type custom field.

Guided how to use the Fields API shortcode in the conditional statement, with an example:

[wpv-conditional if="('[types field='partner-awards' separator=', '][/types]' ne '')"]

Relevant Documentation:

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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Karachi (GMT+05:00)

This topic contains 2 replies, has 2 voices.

Last updated by katinaA 7 months, 3 weeks ago.

Assigned support staff: Waqar.


You solved the problem we're having previously in this thread:

That got us to where images would display representing each option in a checkbox field.

But today I noticed another problem relating to this.

We are setting up a field called Partner Awards. There are two checkbox options, 2021 Award Winner and 2022 Award Winner. So there are four possibilities for this field:

1) No option selected
2) 2021 option selected
3) 2022 option selected
4) 2021 and 2022 option selected

Earlier today, I noticed there was a problem on Partner pages where we only had the 2022 option selected. It wasn't displaying anything. You showed us how to check if the field is empty and if it is, it shouldn't display anything. But for reasons unknown, the check was giving results when only the 2022 option was selected that should only happen when no options are selected. Note that when 2021 and 2022 were selected, both of those displayed fine. So the conditional was somehow seeing the 2022 option as the same as an empty condition.

So I started playing around with the conditional options. I was able to fix the problem with 2022 not displaying by itself. I was able to get everything working on possibilities 2, 3 and 4 above, but then when no option was selected on the Partner, for some reason the conditional was inexplicably showing the header text that says "Partner Awards:" but then showed no images. No matter what I tried, this header kept showing.

So I looked back at the support thread linked above and put things back to the code you gave us. Now it is still showing this header when no options are selected. I can't figure out what I've done wrong here at all. I can't figure out why it stopped working because I thought I had this thoroughly tested before and it was fine. It is possible that I failed to test possibility #3 with only the 2022 option selected though, and now finally saw the problem now that we are adding new Partners to the site that only have the 2022 award.

If you can help us get rid of the Partner Awards: text again, we'd appreciate it. I'm sure it's a simple setting with the conditional that I'm missing.

You can see an example page where no options are selected in the Partner Awards field here:

hidden link



Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)


Thank you for contacting us and I'd be happy to assist.

As the 'Partner Awards' checkboxes type field has multiple options now, checking only for the empty value won't be enough and you can use the Types fields API shortcode ( [types field='partner-awards' separator=', '][/types] ) in the conditional statement.
( ref: )

In this case, the conditional statement can be updated from:
( ref: )

[wpv-conditional if="($(wpcf-partner-awards) ne '')"]


[wpv-conditional if="('[types field='partner-awards' separator=', '][/types]' ne '')"]



Perfect! Thanks a bunch.

I don't feel so bad that I couldn't figure it out myself now though. 😉 There's no way I could have instinctively known to code it that way.