Home › Forums › General Issues › How to display unchecked choices › Reply To: How to display unchecked choices
<?php
while (have_rows('car_info', 51)) {
the_row();
$values = get_sub_field('car_what_covered');
$field = get_field_object('car_what_covered');
$choices = $field['choices'];
foreach ($choices as $choice) {
?>
<div class="point-row"><?php echo $choice; ?>
<?php
if ($values && in_array($choice, $values)) {
echo ' (checked)';
} else {
echo ' (not checked)';
}
?>
</div>
<?php
} // end foreach choice
} // end while have_rows
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.