Hi guys, I hope you could help me with my issue. I’m really stuck for a week now. Basically, I need to hide the entire div if the current date field value < today’s date
Here’s the current output of my code on my site
Here’s the repeater on my backend
As you can see it’s hiding the (Nov 24, 2022) because it is already expired, But I need the entire div to be hidden.
Here’s my code
<?PHP
$course_reference = get_field('course-reference-number');
$program_id = get_field('course-program-id');
if( have_rows('course_month_out') ):
while( have_rows('course_month_out') ) : the_row();
if( have_rows('course_schedule_row_dates') ):
?>
<div class="course_block">
<?php
while( have_rows('course_schedule_row_dates') ) : the_row();
$course_date_selector = get_sub_field('course_date_selector');
$course_date_url = date('d-m-y', strtotime($course_date_selector));
$current_date_field = get_sub_field('course_date_selector', false, false);
$currentDateTime = date('Ymd');
if(get_row_index() == '1' ) {
$current_row_date_field = $course_date_url;
}
if($current_date_field < $currentDateTime) {
}
else {
?>
<?php if(get_row_index() > 1 ){ echo ",";}?>
<a href="<?php echo 'https://ei.aimsapp.com/onlineapp/LandingPage.aspx?strProgID=' . $program_id . "&strIntakeID=" . $current_row_date_field . "-". $course_reference . "-01" ?> " target="_blank">
<?php echo $course_date_selector; ?>
</a>
<?php
}
endwhile;
?>
</div>
<?php
endif;
endwhile;
endif;
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.