Sorting By Title in Thyme Calendar

Thyme Calendar sorts by default time (all day events at top and then timed events descending) and then they are sorted by categories. At our office, we want to sort all our events in numerical or alphabetical order so the code to accomplish this, from Ian is:

function custom_event_sort($a,$b) {
if($a['allday'] && $b['allday'])
return strnatcasecmp($a['title'], $b['title']);
if($b['allday'] > 0) return 1;
if($a['allday'] > 0) return -1;
if($a['next'] == $b['next']) {
return strnatcasecmp($a['title'], $b['title']);
return ($a['next'] < $b['next']) ? -1 : 1;
} ?>

Leave a Reply

Your email address will not be published. Required fields are marked *