Page 1 of 1
All-in-One Event Calendar orderby desc (reverse order)
Posted: Sun Jul 27, 2014 11:11 pm
by Neo
I spent lot of time finding a solution to show up latest events first and finally figured it out myself with a little code change in search.php under app/model
You need to find the function "get_events_relative_to" and find following code within it.
Code: Select all
'ORDER BY i.start ' . $order_direction .
', post_title ' . $order_direction .
Replace that with following code.
Hope this will help you guys and if this was helpful don't forget to leave a comment here in ROBOT.LK
Re: All-in-One Event Calendar orderby desc (reverse order)
Posted: Mon Jul 28, 2014 9:29 pm
by Nipuna
Wow This is Cool Neo
Re: All-in-One Event Calendar orderby desc (reverse order)
Posted: Fri Aug 01, 2014 6:48 am
by leonelmcley
This will absolutely can help thanks for sharing!
Re: All-in-One Event Calendar orderby desc (reverse order)
Posted: Thu Aug 20, 2015 4:01 am
by VR51
Version 2.3.2 of All in One Event Calendar has been recoded. The new code to use to rearrange the date order filtering is...
Open the file /app/modal/search.php (same as before)
Find
Code: Select all
if ( false !== $last_day ) {
if ( 0 == $last_day ) {
$last_day = $time;
}
$filter_date_clause = ' i.end ';
if ( $page_offset < 0 ) {
$filter_date_clause .= '<';
$order_direction = 'DESC';
} else {
$filter_date_clause .= '>';
$order_direction = 'ASC';
}
$filter_date_clause .= ' %d ';
$args[0] = $last_day;
$first_record = 0;
}
Replace with
Code: Select all
if ( false !== $last_day ) {
if ( 0 == $last_day ) {
$last_day = $time;
}
$filter_date_clause = ' i.end ';
if ( $page_offset < 0 ) {
$filter_date_clause .= '<';
$order_direction = 'ASC';
} else {
$filter_date_clause .= '>';
$order_direction = 'DESC';
}
$filter_date_clause .= ' %d ';
$args[0] = $last_day;
$first_record = 0;
}
The difference between those two code blocks is that 'ASC' & 'DESC' have been switched around.
Thanks for the original tip, Neo. Ordinarily I'd write tips like this on my own blog but I've found the original tip here so useful I thought I'd show gratitude and post here in this forum instead. Keeping it all in one place, I guess.