Home › Forums › Front-end Issues › Checkboxes and icons › Reply To: Checkboxes and icons
I don’t understand why you are doing this when you are only using the selected values
$field = get_field_object(‘careguide’);
$careguide = $field[‘value’];
when you could just do this
$careguide = get_field('careguide')
But that’s neither here nor there.
You need to output an image based on the value
foreach ($careguide as $care) {
if ($care == 'some value') {
?><img srd="some image url"><?php
} elseif ($care == 'some other value') {
?><img srd="some other image url"><?php
} // .... etc
}
Or you could set the value in the checkbox field to the actual URL
radio field choices
url-1.jpg : label 1
url-2.jpg : label 2
url-3.jpg : label 3
code
foreach ($careguide as $care) {
?><img src="<?php echo $care; ?>"><?php
}
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.