Support

Home Forums Event Espresso Premium Add Event End Date/Time to Table View

Add Event End Date/Time to Table View

Posted: December 14, 2017 at 8:51 pm

Viewing 5 reply threads


abamedicine

December 14, 2017 at 8:51 pm

Hi EE. I was hoping I could get some recent code to add the Event End Date/Time to the Table View template for the most recent version of EE4.

I have searched the forum extensively and tried all the code I’ve found from past posts, but everything I’ve tried either doesn’t work or the code does not match due to it being for an earlier version.

Thank you!


Tony

  • Support Staff

December 15, 2017 at 5:49 am

Hi there,

If you let me know exactly how you want the date to be output I’ll provide some up to date instructions.

For example, do you want both the event start and event end date/times? Or replace the start with the end?


abamedicine

December 16, 2017 at 3:59 pm

Hi Tony. Essentially I’m just looking to add the Event End Date after the Start Date in the Date column on your Table View.

It is for this page for reference: https://abamedicine.com/aesthetic-medicine-training-schedule/

So Date field would show: January 17, 2018 9:00 am – January 19, 2018 5:00 pm

I realize there would maybe have to be a hypen added. Also, if there is any easy way to remove the Time from this column, and just show dates ( so January 17, 2018 January 19, 2018) I would be interested in seeing if we could make that happen too.

Thank you very much for any help, I really appreciate it!


Tony

  • Support Staff

December 19, 2017 at 4:58 am

Ok, so you’ll need to copy the existing template from within:

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

Your using the espresso-events-table-template.template.php template above, so copy that file and place it within your themes root directory, preferably a child theme as otherwise if you update your theme you’ll lose your custom template.

Open up that custom template and on line 124 you’ll find:

echo date_i18n( $date_format . ' ' . $time_format, strtotime( $datetime->start_date_and_time('Y-m-d', 'H:i:s') ) );

Change that to:

echo $datetime->date_range( $date_format );

That outputs a date range with no times, like this – http://take.ms/NunhR

If your event only has a single datetime, or the datetimes in the event are on the same date it will only output the single date.

Is that what you are looking for?


abamedicine

December 19, 2017 at 6:18 pm

Tony thanks for this. I have a quick question though: why exactly would I move that template file to the root directory? Does it automatically get used instead of when it’s residing in the ‘templates’ directory once move to root? Thanks just trying to get a clear picture of what’s going on.


Tony

  • Support Staff

December 20, 2017 at 1:39 am

Its to allow you to modify templates in a ‘safe’ location rather than hacking up core files and then losing the customizations when the plugin updates. If you edit a plugins files and then update the plugin, WordPress actually deletes the entire plugin directory then downloads the new version and extracts it in its place. So your not really ‘updating’ an exisitng plugin but replacing an older plugin with the new one meaning any files you’ve edited will be replaced. (We don’t support modifying core files and build in multiple ways for you to edit the content you may needed to)

EE checks your theme’s root directory for a lot of the templates it uses (but not all) for any file with the same filename and will use that in place of the default.

The reason we recommend you use a child theme is the same as above, up you place the template in a purchased theme’s directory, then update the theme, the same thing happens as with plugins. But if you have a child theme the child theme is NOT updated when the parent is, so the templates can safely sit there regardless of the parent theme.

If you don’t have a child theme then you can follow this guide to create one:

https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/

Viewing 5 reply threads

The support post ‘Add Event End Date/Time to Table View’ 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.

Event Espresso