I feel like this should be easy but for some reason I can’t get this to work?
I have several similar but distinct colors in list of products. I need to be able to grap the label to show to the end user (so they see orange instead of m_orange) but I also need the value to be distinct so I can apply the appropriate class to the element.
orange : orange
m_orange : orange
purple : purple
m_purple : purple
w_purple : purple
My code:
<?php while ( $the_query->have_posts() ) : $the_query->the_post();
$color = get_field('color');
?>
<?php foreach($color as $color_list){echo "<li >$color_list <span class=\"color_text_slash\"> / </span> </li>";}?>
<?php foreach($color as $color_class){echo "<li class=\"$color_class\"></li>" ;}?>
I tried to follow instructions at http://www.advancedcustomfields.com/resources/field-types/checkbox/ but it hasn’t worked and I can’t seem to figure this out?