Support

Home Forums Event Espresso Premium Displaying multiple dates as a range

Displaying multiple dates as a range

Posted: July 24, 2015 at 9:00 pm

Viewing 5 reply threads


Tom

July 24, 2015 at 9:00 pm

I have set up classes that meet each day of the week for several months, say every monday from sept – dec. Each class is a single event with multiple dates assigned to it. I would like the display to show the range, i.e. Sept 17th-Dec 17th rather than listing every date separately. Is this possible? thank you.


Lorenzo Orlando Caum

  • Support Staff

July 27, 2015 at 10:23 am

Hi Lisa,

Could you please let us know the version of Event Espresso that you are using?

You can check by logging into your WP dashboard and going to the plugins screen.

If you are using Event Espresso 4, then there is a date range function available that can be added to one of the template files.

Thanks


Lorenzo


Tom

July 27, 2015 at 8:16 pm

I am using 4 yes. I am currently hiding the dates via css since they are too long, I would very much like to show them!


Josh

  • Support Staff

July 28, 2015 at 8:50 am

Hi Lisa,

You can change the datetimes display to a range of dates by copying over one template from the Event Espresso 4 plugin’s /public/Espresso_Arabica_2014/ folder. Its name is content-espresso_events-datetimes.php.

You copy this file to your active WordPress theme folder. We recommend setting up a a child theme to preserve your changes in the event of an update.

Then, inside the template, you change this line of code:

<?php espresso_list_of_event_dates( $post->ID );?>

to this:

<?php espresso_event_date_range( '', '', '', '', $post->ID ); ?>


Tom

July 28, 2015 at 8:18 pm

This is wonderful and very appreciated. Is there any way to adjust the format? It currently displays the event like this:

September 8, 2015 9:30 am – December 15, 2015 10:15 am

Is it possible to display it as:

September 8, 2015 – December 15, 2015
9:30 am – 10:15 am

Similar to how an event with a single time would display?

Thanks so much


Josh

  • Support Staff

July 29, 2015 at 7:58 am

You can adjust the format by re-arranging the code that displays the dates and times from within the espresso_event_date_range() template tag. Since the espresso_event_date_range() function is pluggable and can load from your custom plugin (tip: make sure your plugin loads before Event Espresso does by naming it starting with the letters a-eu), you will not lose this change on an update.
To make your own custom date range function, you go in and copy the espresso_event_date_range() function from Event Espresso’s /public/template_tags.php file, into your own plugin.
Then, you change the last few lines of that function just like the way it’s changed in this example:
https://gist.github.com/joshfeck/143e808c38d9ac82a658

Viewing 5 reply threads

The support post ‘Displaying multiple dates as a range’ 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