Home › Forums › ACF PRO › Show lowest value › Reply To: Show lowest value
I would probably do something like this.
if (have_rows('formule')) {
$high = 0;
$low = 999999; // set to something higher than the highest can possibly be
echo '<p>';
while (have_rows('formule')) {
the_row();
the_sub_field('prix_de_la_formule');
echo '<br />';
$value = get_sub_field('duree_prestation');
if ($value > $high) {
$high = $value;
}
if ($value < $low) {
$low = $value;
}
} // end while have rows
echo $low;
if ($low != $high) {
echo ' to ',$high;
}
echo '</p>';
} // 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.