I was hoping that you could lead me in the right direction to have the “select dates” field on the event search page have a drop down menu with the dates already populated.( Ie. you choose between jan1, jan2, jan3…. ect.) instead of the calendar.

Tim Passarella
Hi Tim,
Apologies this hasn’t been answered sooner. Unfortunately it’s not possible to do this (at least not without editing event-organiser-pro/includes/shortcodes.php
. ( Also, wouldn’t a select with [month]-[day]
land you with a select menu with 365 options? – or perhaps I’ve misunderstood what you’re asking :/ )

Stephen Harris
Hey Stephen,
Thanks for the response. You are correct in that there would be 365 options but i was hoping they could be filtered to only include days with events. Basically I have a 2 week event that has multiple venues and multiple events. I just want the events search page to show dates against the query instead of the calendar.

Tim Passarella
I see. This isn’t possible without editing the core plug-in (unless you create your own shortcode which does something similiar to the event search shortcode but replaces the datepickers with a drop-down select).
Getting all dates with an event on them isn’t trivial either (unless all events are just one-day events). But the idea is that you can pull all future occurrences, and each occurrence gives you a date range (start to end of that occurrences). By ‘overlaying’ those ranges you’ll get a set of dates on which an event occurs.
$events = eo_get_events( array(
'event_start_after' => 'now',
) );
$dates_array = array();
if( $events ){
foreach( $events as $event ){
//Start & end date
$start = eo_get_the_start( DATETIMEOBJ, $event->ID, null, $event->occurrence_id );
$end = eo_get_the_end( DATETIMEOBJ, $event->ID, null, $event->occurrence_id );
$pointer = clone $start;
while( $pointer <= $end ){
$dates_array[$pointer->format( 'Y-m-d' )] = true; //Add date as array key
$pointer->modify( '+1 day' );
}
}
}
//Array of dates, in chronological order with events occurring on them.
$dates = sort( array_keys($dates_array) );
Of course the format ‘Y-m-d’ is used because its unambiguous and readily sorted. For output you could used eo_formate_date()
.
If you want just a range of dates which encompasses all events (regardless of ‘gaps’ with no events) – it’s a little easier: just get the start date of the next event and the last date of the last event.

Stephen Harris