Home › Forums › Front-end Issues › Show the values of a custom field as icons › Reply To: Show the values of a custom field as icons
Yes, sorry for the confusion of my question.
I thought it served the same code for both, regardless of the multiple-choice factor.
But his indication was perfect to find the code I needed.
It had been several times and select the checkbox documentation but I could not understand.
Now it works perfect for single or multiple value select and checkbox.
<?php
if( in_array( 'red', get_field('colors') ) )
{
echo '<span class="red"></span>';
}
if( in_array( 'green', get_field('colors') ) )
{
echo '<span class="green"></span>';
}
?>
Thanks for your help
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.