Support

Home Forums Event Espresso Premium EE4 Table View add-on showing archived events

EE4 Table View add-on showing archived events

Posted: October 22, 2014 at 12:06 pm


Ray

October 22, 2014 at 12:06 pm

Can you help me understand why EE4’s Table View add-on shows past/archived events – when the event has MULTIPLE dates?

I have an event with two dates, one in August, and one in October. However, the Table View still shows the August events that have been archived (automatically).

http://take.ms/w2kpf


Josh

  • Support Staff

October 22, 2014 at 12:37 pm

Hi Ray,

The table template displays the event’s primary datetime. You can make it display the next upcoming datetime instead of the primary datetime by adding a 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:


Ray

October 22, 2014 at 4:41 pm

Ok, thanks!


Josh

  • Support Staff

October 22, 2014 at 6:36 pm

You’re welcome.

The support post ‘EE4 Table View add-on showing archived events’ 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 4 years, 7 months ago ago

Topic Tags

Tagged: 

Notifications

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