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');
}
}
}
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.