Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Last active March 3, 2016 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzocaum/0b9e748cf873f1d1b80e to your computer and use it in GitHub Desktop.
Save lorenzocaum/0b9e748cf873f1d1b80e to your computer and use it in GitHub Desktop.
How to remove the end time from the event listings page and single event pages in Event Espresso 4

This can be done by using moving a copy of the espresso_list_of_event_dates function from the template_tags.php file into a site specific plugin and then making changes to remove end time.

The espresso_list_of_event_dates function can be found in the template_tags.php file which can be found here:

/wp-content/plugins/event-espresso-core-reg/public/template_tags.php

Step 1) Copy the function for espresso_list_of_event_dates into a site specific plugin. Here is how to create one:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

Now we can make some changes.

Step 2) Go to the function that is in your site specific plugin and look for the section that looks like this which is at about line 643:

					$html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->time_range( $time_format );

Change it to this:

					$html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->start_time( $time_format );

Then save changes.

You can then head to one of your single event pages and you'll see that only the start time is shown. Below is an example for an event that takes place on March 5.

Before (default option shows start and end time): http://cl.ly/420R1a2n2Q2I

After (shows only start time): http://cl.ly/0j191g210834

Addendum

Remove the time range altogether

In step 2, look for this line at about line 642:

					$html .= '<span class="dashicons dashicons-calendar"></span>' . $datetime->date_range( $date_format ) . '<br/>';
					$html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->time_range( $time_format );

Then replace it with this:

					$html .= '<span class="dashicons dashicons-calendar"></span>' . $datetime->date_range( $date_format );
					//$html .= '<span class="dashicons dashicons-clock"></span>' . $datetime->time_range( $time_format );
@lorenzocaum
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment