Home › Forums › Add-ons › Repeater Field › Date picker excluding past repeater fields › Reply To: Date picker excluding past repeater fields
Is this a date or a date/time field?
// date field
if (have_rows('academy_dates')) {
while (have_rows('academy_dates')) {
the_row();
$raw_date = get_sub_field('date', false);
$today = date('Ymd');
if ($raw_date < $today) {
// skip it
continue;
}
// the rest of your code here....
} // end while
} // end if
// time field
if (have_rows('academy_dates')) {
while (have_rows('academy_dates')) {
the_row();
$raw_date = date('Ymd', get_sub_field('date', false);)
$today = date('Ymd');
if ($raw_date < $today) {
// skip it
continue;
}
// the rest of your code here....
} // end while
} // end if
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.