Home Forums Event Espresso Premium ee4 events table view template – event start date

ee4 events table view template – event start date

Posted: October 17, 2014 at 9:26 am

laura Krug

October 17, 2014 at 9:26 am

Do you have a suggested work-around for correctly displaying events that are in a series where the original start has past but there are still upcoming dates in the series? ie. Event dates are oct 1, 12, 20, 27. At the moment, order_by=start_date pulls the first event date in the series even if expired. I tried order_by=event_date just for fun but that didn’t work. Over half of our events are series events. This makes a grid view of the events un-workable. We already scrapped the calendar plug-in because it wasn’t showing properly on mobile. Suggestions appreciated. TY.

We are using EE4=Version 4.4.3.p
Events Table Template Version 1.2.p

laura Krug

October 20, 2014 at 4:07 pm

Anyone out there?


  • Support Staff

October 20, 2014 at 4:24 pm

Hi Laura,

I’ve been looking into this. By “correctly” do you mean something along the lines of “the next upcoming date for this event”, or something else?

laura Krug

October 20, 2014 at 6:37 pm

Hi Josh, TY for your reply.
Yes, “the next upcoming date for this event” is exactly what I am thinking. Currently, if the event series begins on Oct 2 that is the date the event shows in the events table even though that date has past.


  • Support Staff

October 20, 2014 at 8:08 pm

Hi Kristen,

This is possible with a few edits and a new template tag function. First, here’s the function:

function espresso_next_upcoming_event_date( $EVT_ID = 0, $date_format = '', $time_format = '', $show_expired = NULL ) {
	$date_format = ! empty( $date_format ) ? $date_format : get_option( 'date_format' );
	$time_format = ! empty( $time_format ) ? $time_format : get_option( 'time_format' );

	EE_Registry::instance()->load_helper( 'Event_View' );
	$datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, $show_expired );

	if ( is_array( $datetimes ) && ! empty( $datetimes )) {
		global $post;
		foreach ( $datetimes as $datetime ) {
			if ( $datetime instanceof EE_Datetime ) {
				$the_dates[] = $datetime->date_range( $date_format );

	$html = array_shift( $the_dates );
	return $html;

You can add the function to the table template file, your theme’s functions.php file, or (recommended) into a custom snippets plugin. Basically what this function does is return the next upcoming date for the event.

Then you open up the espresso-events-table-template.template.php file and look for this line of code around line 98 or so:

<td class="start_date event-<?php echo $post->ID; ?>" data-value="<?php echo strtotime($post->DTT_EVT_start); ?>"><?php espresso_event_date( $date_option, $time_option ); ?></td>

You’ll replace it with this:

  • This reply was modified 5 years, 9 months ago by  Josh. Reason: fix code formatting

The support post ‘ee4 events table view template – event start date’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: closed

Updated by  Josh 5 years, 9 months ago ago

Topic Tags


This topic is: not resolved
Do NOT follow this link or you will be banned from the site!