Support

Account

Home Forums Add-ons Repeater Field Remove Expired (DATEPICKER) Row

Unread

Remove Expired (DATEPICKER) Row

  • Hi there,

    Have been trying to look for a solution to my problem for a couple of days now and unfortunately, am still no nearer to sorting this out…hence the message!

    Am using ACF REPEATER to organise a small EVENT CALENDAR. Have already sorted out the ordering by the dates but now would like to remove/hide the rows when the date has expired.

    Below is the code I’m working with:

    
    <?php 
    		// get repeater field data
    		$repeater = get_field('event_calendar');
    		
    		// vars
    		$order = array();
    		
    		// populate order
    		foreach( $repeater as $i => $row ) {
    			$order[ $i ] = strtotime($row['date']);
    		}
    
    		// multisort
    		array_multisort( $order, SORT_ASC, $repeater );
    		
    		// loop through repeater
    		if( $repeater ):  ?>
             
     		<?php foreach( $repeater as $i => $row ): 
     
     
     		?>
           
    		<div class="calendar-wrapper">
            
            	<div class="event-icon"><img src="<?php echo $row['icon'];?>" alt="ICON"/></div>
            	<div class="event-date"><?php echo $row['date']; ?></div>
            	<div class="event-name"><?php echo $row['event_name']; ?></div>
               <div class="event-venue"><?php echo $row['event_venue']; ?></div>
    			<div class="event-promo"><a href="<?php echo $row['link']; ?>" title="">PROMOTION</a></div> 
           
                
    		</div>	
    		
    		<?php endforeach; ?>
    		<?php endif; ?>
    

    Any help would be greatly appreciated. Have been looking through the forums and can’t seem to find a solution that will work for me. Thanks!

Viewing 1 post (of 1 total)

The topic ‘Remove Expired (DATEPICKER) Row’ is closed to new replies.