I cannot for the life of me figure out why I can’t get the start date for each occurence. My current code pulls the start date for the first occurrence–I ned the output to show the start date for each occurence of each event in a category.
<?php
$events = eo_get_events(array(
'numberposts'=>-1,
'tax_query' => array(
array(
'taxonomy' => 'event-category',
'field' => 'slug',
'terms' => 'events'
)
)
));
if($events):
foreach ($events as $event):
setup_postdata( $event );
$startdate = eo_get_the_start('M j', $event->ID,null,$event->occurrence_id);
echo $startdate; ?>
endforeach;
endif;
wp_reset_query(); ?>
But this just gets the start date of the first occurrence. I’ve tried using eo_get_current_occurrence_of() and some other attempts using posts to the forums, but nothing returns the current occurrence’s start date.
Help?

Brent Barkley
Hi Brent,
In the plug-in’s settings are you grouping occurrences? If so, that will only get the next occurrence matching the query. Maybe try:
$events = eo_get_events(array(
'numberposts'=>-1,
'group_occurrences_by' => 'occurrence',
'tax_query' => array(
array(
'taxonomy' => 'event-category',
'field' => 'slug',
'terms' => 'events'
)
)
));
Otherwise it looks good to me (though you don’t need the wp_reset_query()
or setup_postdata()
when using eo_get_events()
).
Let me know if the above helps or not, and if it doesn’t I can debug this is a bit further.

Stephen Harris
Hi Stephen,
I would like to display list of events grouped by category. A perfect example of how this is done can be found here:
http://www.acuitytraining.co.uk/dates-prices/
Any help offered will be appreciated. Also, if sharing code snippet, please include the file name and location within file where the snippet can be embedded, as I have noticed that the code snippets you share do not necessarily have this information.

Bond Nwonye
Hi Bond,
Unless editing a template file, all custom scripts should go in a utility plugin (although theme’s functions.php will also work).
Would this event list be rendered by the event list shortcode?

Stephen Harris