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)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.