Posted: March 1, 2017 at 4:05 am
I have events with multiple dates. I use the toggle template and have made changes to it to show ‘from … to …’ as follows: // Reset the datetimes pointer to the earlest datetime and use that one. </td> This only shows the start date and time, followed again by the start date (instead of the end date). I don’t understand the logic of the loop. Can someone help, please? |
|
This line:
Will only output the end DATE and not the time. So if the datetime start date and end date are on the same day it will look like its outputting the start date, but it’s not. Change that to use:
And that should work. However, that code is going to loop over all of the datetime within an event and output the start dates, then AFTER that loop over all of the datetimes and output the end dates. So if you have 3 datetime in an event you would end up with something like this: March 1, 2017 8:00 am To March 1, 2017 5:00 pm Is that how you want to output the details? March 1, 2017 8:00 am to March 1, 2017 5:00 pm |
|
Thanks, Tony, for taking me seriously and taking the trouble to respond. But your solution is not quite right, I’m afraid. My event called ‘Kurs 1’ has a whole series of dates: But when I expand the toggle, I only see the first date, both for start and end: I don’t get a list of dates. I suspect the line: Also, the date and time formats (‘Y-m-d’, ‘H:i:s’) seem to be ignored, because they are overridden by the $date_format . ‘ ‘ . $time_format, which I’d like to be able to modify but I don’t know their structure. I’d very much appreciate some help with this code. |
|
Resets the pointer of the $datetimes array and returns the first element from the array, that’s unlikely to be your problem. By default the table template only pulls (and displays) a single datetime, have you added That tells the template to pull all datetimes. Take a look here for a list of available parameters: https://eventespresso.com/wiki/events-table-view-template-add-on/
Its not ignored, its intentional set that way to make sure the correct format is output in the end. $date_format and $time_format will use your sites current date and time formats set within Dashboard -> Settings -> General. You can override them by passing your own formats in place of those variables, the format used is shown here: |
|
OK, were getting there! Thanks, Tony. I’ve added the ‘show_all_datetimes=true’ and now understand how to format date and time. But now the start dates of all appointments are listed, then all the end dates. So I now need to find a way of displaying only the start date of the first appointment and the end date of the last appointment. Any suggestions? |
|
That’s expected with the current code, pulls in all of the datetimes and your looping over all of them to output the dates from each. To do what your looking to do you need to completely change the code used for the datetime output (the loops your using). You’ll need something like:
Then those two variables contain the dates you need to output in the format you’ve provided within $date_format for each. |
|
Fantastic! How can I thank you, Tony? |
|
No need to thank me 🙂 However it would be greatly appreciated if you could share your Event Espresso experience in a review. |
|
The support post ‘How can I display end dates using Event Table addon?’ 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.