You’re using the_field()
for a field type that stores an array, which is automatically imploding the array with ', '
as a separator. You need to use get_feild()
and do the imploding yourself, as well as the logic involved in testing to see if anything is returned.
$classes = '';
$value = get_field('select_field_name);
if ($value) {
$classes = implode(' ', $value);
}
echo $classes;