Support

Home Forums Event Espresso Premium How to hide past events on the My Events shortcode Reply To: How to hide past events on the My Events shortcode

Reply To: How to hide past events on the My Events shortcode

Author Replies
Josh # Posted on May 15, 2018 at 9:18 am

I forget that you were removing past events later. You can do this instead:

<?php 
foreach ($objects as $object) :
    $object->start = '';
    if (! $object instanceof EE_Event) {
        continue;
    }
    $datetimes = array();
    $datetime = EEM_Datetime::instance()->get_primary_datetime_for_event( 
        $object->ID(), 
        true, 
        false
    );
    if(! $datetime instanceof EE_Datetime) {
        continue;
    }
    $object->start = $datetime->get_raw('DTT_EVT_start');
endforeach;
usort($objects, function($a, $b) {
    return strcmp($a->start, $b->start);
}); 
?>
Do NOT follow this link or you will be banned from the site!