Support

Account

Home Forums Add-ons Repeater Field A repeater in random order including select fields Reply To: A repeater in random order including select fields

  • Ah think it makes sense now… forgive my previous mistakes, was confused about your objective 😛

    So I think I get it know:

    You enter each caption and then choose a color corresponding to that caption right? So you enter caption 1 and choose the image for that caption to be grey.

    In that case, this is what you want to do:

    <?php
    		
    		$template_directory = bloginfo('template_directory');
    
            $rows = get_field('slider_image');
    
            if($rows) {
    
                echo '<ul>';
    
                $i = 0;
    
                while(has_sub_field('slider_image')) {
    
                      $field = get_sub_field_object('logo_colour');
                      $value = get_sub_field('logo_colour');
                      $label = $field['choices'][ $value ];
    
                      echo '<li>' . $rows[$i]['the_caption'] . '</li>';
                      echo '<li><img src="'. $template_directory . '/logo_'. $label . '.png" /></li>';
                      
                      $i++;
    
                }
    
                  echo '</ul>'; 
           }
               
    ?>