Posted: June 16, 2014 at 2:13 pm
|
in the upcoming event widget, events are sorted by date but not time. also, can we show event’s date+time first before event name? thanks, |
|
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? |
Hello, are your 10 upcoming events set to published through the Event Editor? — |
|
|
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. thanks, |
|
for WP dashboard, i take my words back. |
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 — |
|
|
ok, i am fine with the dashboard. for the upcoming event widget, events are sorted by date but not time. |
|
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. |
|
perfect! thank you so much! |
|
one follow-up question. on event overview page, we would like to show events sorted by data+time as well. thanks, |
|
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 "; |
|
updated it as you said but it didnt either help or hurt. any idea? |
|
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 ";
|
|
exactly that is what i did. from: to: |
|
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 crashed as expected. any other idea? |
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? |
|
|
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! |
|
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. |
|
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.