Support

Account

Forum Replies Created

  • Repeater on my backend

  • Output of the current code

  • 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;
    
  • Hi guys can you help me to fix my issue? Basically, I added a div to my acf repeater items but I need 3 items per div

    <?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();

    $count = 0;
    $group = 0;

    if( have_rows(‘course_schedule_row_dates’) ):
    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 ($count % 3 == 0) {
    $group++;
    ?>
    <div class=”course_block”>
    <?php
    }
    if($current_date_field < $currentDateTime) {

    }
    else {
    ?>
    <?php if(get_row_index() > 1 ){ echo “,”;}?>
    ” target=”_blank”> <?php echo $course_date_selector; ?>

    <?php
    }

    if ($count % 3 == 2) {
    ?>
    </div>
    <?php
    }
    $count++;

    endwhile;
    endif;
    endwhile;
    endif;

    Here’s the screenshot of the expected output and the current output of this code

Viewing 4 posts - 1 through 4 (of 4 total)