Support

Home Forums Event Espresso Premium show events by date AND time

show events by date AND time

Posted: June 16, 2014 at 2:13 pm


karen wang

June 16, 2014 at 2:13 pm

in the upcoming event widget, events are sorted by date but not time.
can we change it?

also, can we show event’s date+time first before event name?

thanks,
karen


karen wang

June 16, 2014 at 2:17 pm

One similar question.

in WP dashboard, we are showing 10 espresso events, but they are not the latest 10 events. How can make sure the latest ones show up?


Lorenzo Orlando Caum

  • Support Staff

June 16, 2014 at 3:41 pm

Hello, are your 10 upcoming events set to published through the Event Editor?


Lorenzo


karen wang

June 16, 2014 at 3:45 pm

Yes, I added all events using espresso “add new”

the widgets are showing the latest events but are only sorted by date, not by time.
the WP dashboard is bad which is not showing the latest 10 at all.

thanks,
karen


karen wang

June 16, 2014 at 3:47 pm

for WP dashboard, i take my words back.
It is showing the latest 10 events but not sorted by date at all.


Lorenzo Orlando Caum

  • Support Staff

June 16, 2014 at 3:49 pm

Hi,

It will be sorted by a status of active/ongoing and then by alphabetical order.

Click on start date and it will then sort by event date: http://cl.ly/image/0P2k301M1t2Y


Lorenzo


karen wang

June 16, 2014 at 3:54 pm

ok, i am fine with the dashboard.

for the upcoming event widget, events are sorted by date but not time.
can we change it to be sort by date+time?
also, can we show event’s date+time first before event name?


Dean

June 16, 2014 at 11:50 pm

Hi KAren,

If you don’t mind making a couple of minor edits to the widget.php template file it’s quite easy to achieve this.

Before making any edits, copy the event-espresso/templates/widget.php over to wp-content/uploads/espresso/templates/ and edit the file there. This will make sure updates don’t over write your changes.

On line 47 it reads:

$order_by = " ORDER BY date(start_date), id ASC ";

change it to

$order_by = " ORDER BY date(start_date), time(start_time) ASC ";

That will make the items order by date and time.

On line 130 it reads:

<li><a href="<?php echo $registration_url; ?>"><?php echo stripslashes_deep($event->event_name) ?> - <span class="widget-event-date"><?php echo event_date_display($event->start_date) ?></span></a>

change it to

<li><a href="<?php echo $registration_url; ?>"><span class="widget-event-date"><?php echo event_date_display($event->start_date) ?></span> - <?php echo stripslashes_deep($event->event_name) ?></a>

Obviously this is quite basic, if you need further modifications made I would advise you to get in touch with your web developer for assistance.


karen wang

June 17, 2014 at 4:33 pm

perfect! thank you so much!


karen wang

June 17, 2014 at 5:12 pm

one follow-up question.

on event overview page, we would like to show events sorted by data+time as well.
which PHP file to update?

thanks,


Dean

June 18, 2014 at 1:53 am

Hi,

The event_list.php file.

This file and the event_list_display.php can be copied over to wp-content/uploads/espresso/templates and edited there.

It is important to copy both even though only one will be edited, as otherwise it wont work.

I haven’t tested it but is should be line 182 that needs changing.

$sql .= $order_by != 'NULL' ? " ORDER BY " . $order_by . " ".$sort." " : " ORDER BY date(start_date), id ASC ";


karen wang

June 19, 2014 at 1:46 pm

updated it as you said but it didnt either help or hurt.
events are still sorted by date and id.

any idea?


Dean

June 19, 2014 at 10:47 pm

Hi,

My above note may not have been clear,

Did you change this (line 182)

$sql .= $order_by != 'NULL' ? " ORDER BY " . $order_by . " ".$sort." " : " ORDER BY date(start_date), id ASC ";

to this

$sql .= $order_by != 'NULL' ? " ORDER BY " . $order_by . " ".$sort." " : " ORDER BY date(start_date), time(start_time) ASC ";
  • This reply was modified 9 years, 11 months ago by  Dean.


karen wang

June 22, 2014 at 1:48 pm

exactly that is what i did.

from:
$sql .= $order_by != ‘NULL’ ? ” ORDER BY ” . $order_by . ” “.$sort.” ” : ” ORDER BY date(start_date), id ASC “;

to:
$sql .= $order_by != ‘NULL’ ? ” ORDER BY ” . $order_by . ” “.$sort.” ” : ” ORDER BY date(start_date), time(start_time) ASC “;


Sidney Harrell

June 22, 2014 at 8:22 pm

Throw a

die("here");

statement in there and reload the page, see if it makes it crash, and then take the die statement back out.
It’s a quick way to check to see if that piece of code is getting executed. It may be loading the event_list.php from another location.


karen wang

June 23, 2014 at 7:31 am

it crashed as expected.

any other idea?


Tony

  • Support Staff

June 23, 2014 at 7:52 am

Hi Karen,

Looking at your events it appears they are ordered correctly by date then time.

For example your first two event’s on the event-registration page are both on today’s date. If you edit the ‘Mindful Meditation’ (http://take.ms/j7jV3) event and temporarily set the start_time to say ‘8:00 am’ then refresh the event list, it should then be displayed above the other event. Then just change it back to the original time.

If the above is correct then that is the expected behaviour with the modification in place, are you expecting something different?


karen wang

June 23, 2014 at 3:20 pm

Hi Tony,

I meant to ask how to sort events in event overview for administrator, not for public. In wordpress admin page, if i go to event espresso -> event overview, i see events are sorted by date only, i would like it to be sorted by data and time.

sorry for the confusion. hope i made it clear this time. thanks!


Dean

June 24, 2014 at 1:36 am

Hi,

The easiest way to do this is to click the date column to order it how ou want and then press the SHIFT key and while holding that click the time column.

This will filter the table by date and time.


karen wang

June 24, 2014 at 4:00 pm

yes, that is exactly what i was looking for.

sorry for the confusion. thanks!

The support post ‘show events 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