Home › Forums › Add-ons › Repeater Field › Compare dates in rows against today › Reply To: Compare dates in rows against today
Hi @phatoz
If I get it right, you should provide the current date. Also, I’m sorry I forgot to remove the number “85”. It’s just a post ID for testing purpose. So, your code should be like this:
<?php
// date starting the week of loaded treasure bag
$today = date('Ymd');
$last_week = $today-6;
$next_week = $today+6;
$treasure_bag_date = get_sub_field('treasure_bag_date');
?>
<tr <?php if( ($treasure_bag_date >= $last_week) && ($treasure_bag_date <= $next_week) ){ echo "id='active_week'"; }?>>
I hope this helps 🙂
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.