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>';
}
?>
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.