Home › Forums › Add-ons › Repeater Field › Get minimum value from ACF Repeater › Reply To: Get minimum value from ACF Repeater
if (have_rows('fares_from')) {
$term = false;
$fare_price = false;
while (have_rows('fares_from')) {
the_row();
if ($fare_price === false || get_sub_field('fare_price') < $fare_price) {
$fare_price = get_sub_field('fare_price');
$term = get_sub_field('fares_from_taxonomy');
}
} // end while have rows
if ($term) {
?>
<span><?php echo $term->name; ?></span>
<span><?php echo $fare_price; ?></span>
<?php
}
} // end if have rows
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.