Support

Account

Home Forums ACF PRO Get specific values from repeater Reply To: Get specific values from repeater

  • The only way you can get a specific row based on at value is to loop over the repeater until you find what you’re looking for and then show it.

    
    if (have_rows('dates_repeater')) {
      while (have_rows('dates_repeater')) {
        the_row();
        $now = date('Ymd'); // this is the format stored by ACF
        // the above is also the format you need to use to compare dates
        // the second parameter of <code>false</code> tells ACF not to format
        // the value so that we can compare them
        if (get_sub_field('date_start', false) >= $now && 
            get_sub_field('date_end', false) <= $now) {
          the_sub_field('price_by_dates');
        }
      }
    }