Skip Navigation

[Resolved] Icons in Custom values for selected and not selected states of checkboxes

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

Problem: I would like to use a checkboxes group to display different icons using something like FontAwesome. Can I insert the icons in the checkboxes field values using HTML?

Solution: It's best to use a simple string as the value of each checkbox in a checkboxes group. Instead of using complex HTML in these values, use the "state" and "checked" options in the Types field shortcode, or use conditionals to display different content based on the checked checkboxes.

[types field="my-checkboxes" option="0" state="checked"]Add icon 1 HTML here[/types]
[types field="my-checkboxes" option="1" state="checked"]Add icon 2 HTML here[/types]
[types field="my-checkboxes" option="2" state="checked"]Add icon 3 HTML here[/types]

Relevant Documentation:
https://toolset.com/documentation/customizing-sites-using-php/functions/#checkboxes

This support ticket is created 4 years, 7 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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 2 replies, has 2 voices.

Last updated by David Gimenez 4 years, 7 months ago.

Assisted by: Christian Cox.

Author
Posts
#1583931

Hi there.

I have a custom field with a lot of checkboxes

I put that custom field in a content template and I select -> Custom values for selected and not selected states. Here... if I write text like as custom value works right but if I write a fontawesome icon like as custom value it don't show anything.

My question is -> Is it possible to insert icons in that fields?

Thanks in advanced

#1584371

Hello, I wouldn't try to add complex HTML in the value of each checkbox. Instead, I would store a simple unique string and use one of the approaches in this ticket: https://toolset.com/forums/topic/result-of-checkboxes-and-css-in-a-shortcode/
One is a conditional-based approach, and the other uses the "state" and "option" attributes of the Types field shortcode to display different icons based on the selected option.

Let me know if you have questions about that.

#1584879

My issue is resolved now. Thank you!