Home › Forums › ACF PRO › Add value as classes checkbox › Reply To: Add value as classes checkbox
It’s not exactly what I want. But I find out the solution :
<?php $field = get_field_object('equipement');
$equipements = $field['choices'];
$equipements_selected = $field['value'];
if (sizeof($equipements_selected)>0) {
?>
<ul>
<?php foreach($equipements_selected as $equipClass) {
$equipLabel = $equipements[$equipClass];
?>
<li class="<?php echo $equipClass; ?>"><?php echo $equipLabel; ?></li>
<?php } // foreach ?>
</ul>
<?php } // if sizeof ?>
Thank you for your answer.
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.