[EventCalendar] ordering events category like upcoming list: a
alex at firetree.net
Fri Feb 16 01:38:22 UTC 2007
Exactly what are you trying to achieve?
a. Posts ordered by START DATE, earliest first? OR
b. Posts ordered by END DATE, earliest first? OR
c. Something else?
a. is available "out of the box". Just turn on "Keep Events Separate".
If you want b. then you also need to change 'start' to 'end' in the code
fragment you found.
If you want c., then what is it?
On Thu, 15 Feb 2007 15:29:21 -0500
npessoa at umich.edu wrote:
> Hi, Alex:
> I upgraded to EC 3.1.1, but it didn't do anything to alter the order of
> the events.
> I know there are people out there using the plugin in similar ways, so
> how are they getting their event lists to sort from Now > Future?
> The only thing I can think of is to somehow create a static page called
> "Events" and insert the <php> for the upcoming list, or to delete the
> "Filed under Events" link altogether so people can't see the category
> itself, which is out of order.
> OR... and this is a stretch, because I'm by no means a php goddess, but
> I found this snippet of code in eventcalendar.php:
> ----- CODE EXCERPT ------
> /** Change the order of event listings (only advanced mode). */
> function ec3_filter_posts_orderby(&$orderby)
> global $ec3;
> $regexp='/\bpost_date\b( DESC\b| ASC\b)?/i';
> if($ec3->order_by_start && preg_match($regexp,$orderby,$match))
> if($match && $match==' DESC')
> $orderby=preg_replace($regexp,'ec3_sch.start DESC',$orderby);
> return $orderby;
> ----- END CODE EXCERPT ------
> I'm not "fluent" in php, but it looks like $regexp is ordering the
> posts by post_date. Could this be modified to end_date or whatever
> function EC3 uses to dictate the expiration date of an event?
> I could make a custom template for the Events category -- would this
> help? Would I be able to insert a query for the 'upcoming list' format
> in this way? It seems like one way or another the user will eventually
> get to the "Events" Category, so it would be great to just be able to
> re-order this from Earliest > Latest like I want.
> Thank you for your help - this is the last bit of functionality I have
> to get resolved before I can finish this site over the weekend!! :)
> Blog: http://wpcal.firetree.net/
> EventCalendar at firetree.net mailing list
> Unsubscribe: http://penguin.firetree.net/eventcalendar
:: Let me solve your problems: http://www.firetree.net/consulting/
:: alex.tingle AT firetree.net +44-7901-552763
More information about the EventCalendar