Home › Forums › ACF PRO › Select Field get multipe value AND label › Reply To: Select Field get multipe value AND label
the way to do that the code needs to look something like this:
$field_name = "md_services";
$values = get_field($field_name);
$field = get_field_object($field_name);
if( $values ){
foreach( $values as $value ){
$icon = '<span class="md-service-img"> <img src="' .
get_stylesheet_directory_uri() . '/images/icons/' .
$value . '.png"><span class="md-service-desc">' .
$field['choices'][$value] . '</span></span>';
echo $icon;
}
}
Recently I have created some function that can do this as well and added them to my library of ACF filters and functions https://github.com/Hube2/acf-filters-and-functions/blob/master/acf-field-label-functions.php
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.