Support

Account

Home Forums Backend Issues (wp-admin) Multiple values for checkbox choices Reply To: Multiple values for checkbox choices

  • I would go with what you are doing or code it. Coding could run into a lot of code, depending on how it is coded.

    here is one example, and it is not complete

    To make it easier you can return the value and the label of the field, this is one of the options for the checkbox field. And if you have values set like

    
    WordPress : WordPress
    Plugin A : Plugin A
    Plugin B : Plugin B
    
    
    $values = get_field('my_check_box');
    if ($values) {
      ?>
        <ul>
          <?php 
            foreach ($values as $value) {
              $icon = 'fa ';
              switch ($value['value']) {
                case 'WordPress':
                  $icon .= 'fa-wordpress';
                  $url = 'https://www.wordpresss.org/';
                  break;
                case 'Plugin A':
                  $icon .= 'fa-acorn';
                  $url = 'url here';
                  break;
                case 'Plugin B':
                  $icon .= 'fa-apple';
                  $url = 'url here';
                  break;
                default:
                  // assign a generic icon
                  $icon .= 'fa-something';
                  $url = '#';
                  break;
              } // end switch
              ?>
                <li><i class="<?php 
                    echo $icon; ?>"></i><a href="<?php 
                    echo $url; ?>"><?php echo $value['label']; ?></li>
              <?php 
            } // end foeach value
          ?>
        </ul>
      <?php 
    } // end if values