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:

    // 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?