Support

Account

Home Forums Reply To:

  • 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

    Output of the current code

    Here’s the repeater on my backend

    Repeater

    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;