Home › Forums › Add-ons › Repeater Field › How to get future events with Date Picker? › Reply To: How to get future events with Date Picker?
This is just a basic example, I could not copy and alter your code easily because you didn’t use code tags. You need to test the date before you output the table row, I can’t give specifics because that would depend on knowing how the date is being formatted. I am going to assume that dates are returned in the format “Y-m-d”, which would basically be the only way to tell if the date is in the future.
if (have_rows('calender_event', 'option')) {
while (have_rows('calender_event', 'option')) {
$name = get_sub_field('event_name');
$date = get_sub_field('event_date');
$place = get_sub_field('event_place');
$now = date('Y-m-d');
if ($date > $today) {
?>
<tr>
<td>...</td>
<td>...</td>
<td>...</td>
</tr>
<?php
}
} // end while have rows
} // 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.