Support

Account

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