Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Edit the Events Table View Template Add-on for Event Espresso 4 to show remaining datetime quantities for each event

This can be done by relocating one of the templates and making a change to some lines of code. This will ensure that your customization is not lost on a software update.

The support team at Event Espresso will never recommend you edit any core plugin or add-on files directly.

Here are the steps:

  1. Login to your WordPress root with your preferred SFTP or FTP client. Filezilla and Cyberduck are free options. On a Mac? Try Transmit

  2. Browse to this location:

/wp-content/plugins/eea-events-table-view-template/templates

You'll see two files there:

espresso-events-table-template-toggle.template.php

espresso-events-table-template.template.php

  1. Download a copy of the espresso-events-table-template.template.php file to your computer

  2. Now browse to your child theme:

/wp-content/themes/name-of-your-child-theme

Not using a child theme? A child theme allows you to customize your WordPress theme without losing customizations when you update your theme through WP. Here is how to setup a child theme.

  1. Upload the the file that you downloaded earlier to the location above

  2. Open the espresso-events-table-template.template.php file for editing

At about line 47 you'll see this line of code:

			<?php if( $show_venues ) { ?>
				<th class="th-group"><?php _e('Venue','event_espresso'); ?></th>
			<?php } ?>
  1. Replace the line above with this:
			<?php if( $show_venues ) { ?>
				<th class="th-group"><?php _e('Venue','event_espresso'); ?></th>
			<?php } ?>
			<th class="th-group"><?php _e('Spaces Remaining','event_espresso'); ?></th>
  1. At about line 57, you'll see this line of code:
		<?php echo '<td colspan="' . ($show_venues ? '4' : '3') . '">'; ?>
  1. Replace it with this:
		<?php echo '<td colspan="' . ($show_venues ? '5' : '4') . '">'; ?> 

  1. At about line 115 you'll see this line of code:
			<?php if( $show_venues ) { ?>
				<td class="venue_title event-<?php echo $post->ID; ?>"><?php espresso_venue_name( NULL, FALSE ); ?></td>
			<?php } ?>
  1. Replace it with this:
			<?php if( $show_venues ) { ?>
				<td class="venue_title event-<?php echo $post->ID; ?>"><?php espresso_venue_name( NULL, FALSE ); ?></td>
			<?php } ?>
			<td class="space_remaining event-<?php echo $post->ID; ?>"><?php $total_spaces_left = $datetime->spaces_remaining(); echo $total_spaces_left === INF ? '<span class="smaller-text">' .  __( 'unlimited ', 'event_espresso' ) . '</span>' : $total_spaces_left; ?></td>

Then save changes.

In the first code change, we are adding a new column with a column heading of Spacings Remaining. In the second code change, we are retrieving the values for each datetime for each event and displaying it.

If an event does not have a datetime limit, then the word "unlimited" will show instead of a numeric value. You can change that verbiage by changing the word unlimited to something else during step 9.

@echoleaf

This comment has been minimized.

Copy link

echoleaf commented Jul 22, 2015

Lorenzo - /wp-content/plugins/eea-events-table-view-template/templates does not exist in my install. My main EE plugin folder is /wp-content/plugins/event-espresso-core-reg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.