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!
Accordions are a great way to group related information while allowing users to interactively show and hide content. In this video, Damon Cook goes in-depth on how to create an accessible accordion block using ACF PRO’s Repeater field.https://t.co/RXT0g25akN
— Advanced Custom Fields (@wp_acf) March 2, 2023
© 2023 Advanced Custom Fields.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.