Support

Home Forums Event Espresso Premium List events sorted by date and time

List events sorted by date and time

Posted: August 13, 2014 at 11:00 am

Viewing 9 reply threads


wso

August 13, 2014 at 11:00 am

Is it possible to list events sorted by date, then by start time? Our event pages are listing by date but not in order by start time.


Lorenzo Orlando Caum

  • Support Staff

August 13, 2014 at 12:58 pm

Hi,

What version of Event Espresso are you using?


Lorenzo


wso

August 13, 2014 at 1:26 pm

EE3.


Lorenzo Orlando Caum

  • Support Staff

August 13, 2014 at 1:42 pm

Hi, is it possible that these events were not created in chronological order?

There is a shortcode that can help you sort events but the order that they were created may play a factor here:

https://eventespresso.com/wiki/shortcodes-template-variables/#event-list

Give this a try on a WordPress page:

[EVENT_LIST order_by=date(start_date),id]

You can “preview” before publishing to test it out.


Lorenzo


wso

August 13, 2014 at 3:52 pm

The events were not created in chronological order, no.

The shortcode you posted gave me what I already have, using this shortcode: [EVENT_LIST category_identifier=convention-events-1396839515]

I have a list of events in date order, but not in order of start time. I need the list to be in order by date, then by the event’s start time, for example:

EVENT 1
Date: October 4, 2014
Start Time: 10:00 am

EVENT 2
Date: October 4, 2014
Start Time: 12:00 pm

EVENT 3
Date: October 5, 2014
Start Time: 9:00 am

and so on.


Lorenzo Orlando Caum

  • Support Staff

August 13, 2014 at 6:03 pm

Try this:

[EVENT_LIST category_identifier=convention-events-1396839515 order_by=date(start_date),id]


Lorenzo


wso

August 14, 2014 at 11:11 am

I did try that – it still doesn’t list the events by start time, only by date.

Let me rephrase my request so we’re clear:

Currently, my event listing pages are ordering events by date, but not by time, like so:

EVENT 1
Date: October 4, 2014
Start Time: 10:00 am

EVENT 2
Date: October 4, 2014
Start Time: 12:00 pm

EVENT 3
Date: October 4, 2014
Start Time: 9:00 am

EVENT 4
Date: October 5, 2014
Start Time: 10:00 am

So in some cases, events that start later in the day are showing up on the list before earlier events, as in the example above (the 10:00 am event on October 4 is showing before the 9:00 am event on the same date).

I believe they are ordering first by date, then by ID.

I need the events to be ordered first by date, then by start time, regardless of the ID, like so:

EVENT 1
Date: October 4, 2014
Start Time: 10:00 am

EVENT 3
Date: October 4, 2014
Start Time: 9:00 am

EVENT 2
Date: October 4, 2014
Start Time: 12:00 pm

EVENT 4
Date: October 5, 2014
Start Time: 10:00 am

Is this possible, and if so, how do I do it?


Tony

  • Support Staff

August 14, 2014 at 11:33 am

You’ll need the Order by to be DATE(start_date),TIME(start_time) so something like this:

[EVENT_LIST category_identifier=convention-events-1396839515 order_by=DATE(start_date),TIME(start_time) sort=ASC]

Should work.


wso

August 14, 2014 at 5:17 pm

Thanks, that seems to have done the trick.

I don’t recall seeing time(start_time) listed as an option for orderby parameters on the shortcode page Lorenzo linked to in his second post above. It would have saved a lot of time if that parameter had been listed there.


Dean

August 15, 2014 at 1:26 am

Hi,

Thanks for the feedback, I’ve updated the documentation to include that.

Viewing 9 reply threads

The support post ‘List events sorted by date and time’ 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