Support

Account

Home Forums Front-end Issues Checkboxes and icons Reply To: Checkboxes and icons

  • I don’t understand why you are doing this when you are only using the selected values

    
    $field = get_field_object(‘careguide’);
    $careguide = $field[‘value’];
    

    when you could just do this

    
    $careguide = get_field('careguide')
    

    But that’s neither here nor there.

    You need to output an image based on the value

    
    foreach ($careguide as $care) {
      if ($care == 'some value') {
        ?><img srd="some image url"><?php
      } elseif ($care == 'some other value') {
        ?><img srd="some other image url"><?php
      } // .... etc
    }
    

    Or you could set the value in the checkbox field to the actual URL
    radio field choices

    
    url-1.jpg : label 1
    url-2.jpg : label 2
    url-3.jpg : label 3
    

    code

    
    foreach ($careguide as $care) {
      ?><img src="<?php echo $care; ?>"><?php 
    }