I have a repeater field that has a yes/no select. If not, then a class is added to the div, if yes, then nothing happens. Now, when selecting one element with the value "no", the class is added to all elements. How can I add it for one element?
$team_cards = get_field('team_cards');
$noimage = '';
foreach ($team_cards as $item) {
if ($item["yes_no"] == "no") {
$noimage = "no-image";
}
}
<div class="<?php echo $noimage ?>"></div>
2
Answers
Try this code