eo_get_the_end
since 1.0.0
eo_get_the_end( $format = 'd-m-Y', $post_id, $occurrence_id, $deprecated )
Returns the end date of occurrence of event.
If used inside the loop, with no id no set, returns end 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 deprecated
so you you should now pass a maximum of three arguments, as shown below, with the third argument
specifying the occurrence ID.
Examples
Inside the loop, you can output the end date of event (occurrence)
<?php echo eo_get_the_end( 'jS M Y' ); ?>
Get the end date of the event with id 7 and occurrence ID 3
<?php $date = eo_get_the_end( '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
|
int
|
$post_id |
The event (post) ID. Uses current event if empty.
|
int
|
$occurrence_id |
The occurrence ID
|
int
|
$deprecated |
(Was) the occurrence id, supply this as the third argument
|
Return value
string|\DateTime
|
the end date formated to given format, as accepted by PHP date
|
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
|
|