vendredi 27 mars 2015

Display Selected as well as NOT Selected checkboxes using ACF

I tried to find a related topic on the acf site but that didn't give me the right answer. Hopefully you guys can help me out.


I am building a custom website using ACF, everything is perfect and I managed to get almost everything exactly the way I want but with the checkboxes I can only display the checked ones but not the unchecked.


My idea is that the not checked ones would have a different "class" or "id" and I would display them with a different CSS style.


This is a list of features of the flats for rent, so things like: Internet, TV, etc. Much like airbnb's website.


So the code. I managed to get this code to work:



<?php

$values = get_field('room_features');
if($values)
{
echo '<ul>';

foreach($values as $value)
{
echo '<li>' . $value . '</li>';
}

echo '</ul>';
}

?>


But this doesn't display the unchecked ones, only checked.


I would appretiate any light on this :)





Aucun commentaire:

Enregistrer un commentaire