Last active
April 30, 2019 13:26
-
-
Save jentheo/6629fe1f1b9f9c5cd22423b77ce2d975 to your computer and use it in GitHub Desktop.
Reformat schedule details for multi-day events
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function tribe_reformat_schedule_details( $schedule, $event_id, $before, $after ) { | |
if ( tribe_event_is_multiday( $event_id ) ) { | |
$start_date = tribe_get_start_date( $event_id, false, 'F j' ); | |
$end_date = tribe_get_end_date( $event_id, false, 'F j' ); | |
$end_date = strncmp( $start_date, $end_date, 3 ) === 0 ? tribe_get_end_date( $event_id, false, 'j' ) : $end_date; | |
$start_time = tribe_get_start_time( $event_id ); | |
$end_time = tribe_get_end_time( $event_id ); | |
$schedule = $before . $start_date . ' - ' . $end_date . ' @ ' . $start_time . ' - ' . $end_time . $after; | |
} | |
return $schedule; | |
} | |
add_filter( 'tribe_events_event_schedule_details', 'tribe_reformat_schedule_details', 10, 4 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment