Home › Forums › General Issues › Give "Stylised UI" elements a class › Reply To: Give "Stylised UI" elements a class
You could do something like this and just add the classes to the call in your theme:
<?php
// vars
$field = get_field_object('your_select_field');
$value = $field['value'];
$label = $field['choices'][ $value ];
?>
<p>Items: <span class="select2-results__option item-<?php echo $value; ?> <?php echo $value; ?>"><?php echo $label; ?></span></p>
You can add whatever default classes you need and then the particular select option item classes programmatically via the field object.
Does that help?
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.