In month view, display all-day events below non-all-day events in each individual day cell.
<?php
/**
* In month view, display all-day events below non-all-day events in each individual day cell.
*
* Barry wrote it 2016-02-15
* https://gist.github.com/cliffordp/fc9b2df3c4d7cf062fde
*
* See https://gist.github.com/cliffordp/4a273f419457d8862bb0 for similar customization but for recurring events
*
* Uses two PHP anonymous functions so only compatible with PHP 5.3+
*/
add_filter( 'tribe_events_get_current_month_day', function( $days_events ) {
if ( ! function_exists( 'tribe_event_is_all_day' ) || $days_events['events']->custom_all_day_reordering_done || empty( $days_events['events']->posts ) )
return $days_events;
usort( $days_events['events']->posts, function( $event_a, $event_b ) {
$a_all_days = tribe_event_is_all_day( $event_a->ID );
$b_all_days = tribe_event_is_all_day( $event_b->ID );
if ( $a_all_days && ! $b_all_days ) return 1;
if ( ! $a_all_days && $b_all_days ) return -1;
return 0;
} );
$days_events['events']->rewind_posts();
$days_events['events']->custom_all_day_reordering_done = true;
return $days_events;
} );