Home › Forums › General Issues › [Checkbox] How to display all item as check uncheck › Reply To: [Checkbox] How to display all item as check uncheck
Hi there
Thanks for an awesome plugin. I cant get enough 🙂
I am trying to do something similar to @maxpeerawat… @hube2’s solution works for me but only if I set the field to return a VALUE only. I am using BOTH.
I have tried a few things but have been struggling for hours now. Can you please shed some light or point me in the right direction… I have this so far:
<?php
$values = get_field('features');
$field = get_field_object('features');
$choices = $field['choices'];
foreach ($choices as $value => $label) {
echo $label,': ';
if (in_array($value, $values['value'])) {
echo 'checked';
}
}
?>
Regards
Daryl
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.