Firstly, just want to praise your plugin and give you five stars for a great job! :)
I came across some missing attributes not specified in the shortcode [em-events]. I wanted to use the shortcode twice within a page – once for Upcoming Events and Another for Past Events. I would like to suggest that the Event Listing widget have the functionality to specify a date range or date filtering of sorts to allow an easy way to do this.
In the meantime, I modified the events-maker/includes/template-functions.php to add the attributes in order to use them in the shortcode. I first added a default value to the missing date variables:
$defaults = array(
‘number_of_events’ => 5,
‘thumbnail_size’ => ‘thumbnail’,
‘categories’ => array(),
‘locations’ => array(),
‘organizers’ => array(),
‘order_by’ => ‘start’,
‘order’ => ‘asc’,
‘show_past_events’ => $options[‘show_past_events’],
‘show_occurrences’ => $options[‘show_occurrences’],
‘show_event_thumbnail’ => true,
‘show_event_excerpt’ => false,
‘no_events_message’ => __(‘No Events’, ‘events-maker’),
‘date_format’ => $options[‘datetime_format’][‘date’],
‘time_format’ => $options[‘datetime_format’][‘time’],
‘event_start_before’ => ”,
‘event_start_after’ => ”,
‘event_end_before’ => ”,
‘event_end_after’ => ”
);
..and then to the $events_args :
$events_args = array(
‘post_type’ => ‘event’,
‘suppress_filters’ => false,
‘posts_per_page’ => ($args[‘number_of_events’] === 0 ? -1 : $args[‘number_of_events’]),
‘order’ => $args[‘order’],
‘event_show_past_events’ => (bool)$args[‘show_past_events’],
‘event_show_occurrences’ => (bool)$args[‘show_occurrences’],
‘event_show_featured’ => (bool)$args[‘show_featured’],
‘event_start_before’ => $args[‘event_start_before’]
‘event_start_after’ => $args[‘event_start_after’]
‘event_end_before’ => $args[‘event_end_before’]
‘event_end_after’ => $args[‘event_end_after’]
);
So now we can do this to display past events:
<?php
$args = array(
‘number_of_events’ => 0
,’order’ => ‘desc’
,’show_past_events’ => true
,’date_format’ =>’Y-m-d’
,” => date(“Y-m-d”, time() – 3600*24)
,’event_start_before’ => date(“Y-m-d”, time() – 3600*24)
);
echo em_display_events($args);
?>
P.S. I haven’t tested whether event_start_before should use today’s date or yesterday’s date if I want all events before today.