eo_get_the_start
since 1.0.0
eo_get_the_start( $format = 'd-m-Y', $post_id, $occurrence_id, $deprecated )
Returns the start date of occurrence of event.
If used inside the loop, with no id no set, returns start date of
current event occurrence.
3.0.0 Update: This function used to accept 4 arguments (versions 1.5.6 - 2.11.1), with
the third (null) argument deprecated. While the old behaviour shall still work, it is recommended
that pass a maximum of three arguments, as shown below, with the third argument (not the fourth)
specifying the occurrence ID.
Examples
Inside the loop, you can output the start date of event (occurrence)
<?php echo eo_get_the_start( 'jS M Y' ); ?>
Get the start date of the event with id 7 and occurrence ID 3
<?php $date = eo_get_the_start ( 'jS M Y', 7, 3 ); ?>
Print a list of upcoming events with their start and end date
$events = eo_get_events(array(
'numberposts' => 5,
'events_start_after' => 'today',
'showpastevents' => true,
));
if( $events ){
echo '<ul>';
foreach( $events as $event ){
printf("<li><a href='%s' >%s</a> from %s to %s </li>",
get_the_permalink( $post->ID ),
get_the_title( $post->ID ),
eo_get_the_start( 'jS F Y', $post->ID, $post->occurrence_id ),
eo_get_the_end( 'jS F Y', $post->ID, $post->occurrence_id )
);
}
echo '</ul>';
}else{
echo 'No Upcoming Events';
}
Parameters
string
|
$format = 'd-m-Y' |
String of format as accepted by PHP date or the constant DATETIMEOBJ to return a DateTime object
|
int
|
$post_id |
Post ID of the event
|
int
|
$occurrence_id |
The occurrence ID
|
int
|
$deprecated |
(Was) the occurrence id, supply this as the third argument
|
Return value
string|\DateTime
|
the start date formated to given format, as accepted by PHP date or a DateTime object if DATETIMEOBJ is given as format.
|
Hooks
Changelog
3.0.0
|
Third argument repurposed for the occurrence ID. Fourth argument can still be used, but discouraged.
|
1.5.6
|
Third argument deprecated, use fourth argument to pass occurrence ID.
|
1.0.0
|
|