This snippet adds the start time for an event to its title in Month View. This helps people see at a glance when an event takes place.
Copy and paste the snippet below to your theme’s functions.php. Usually folks paste it somewhere near the top, just under the opening <?php tag.
We hope this tutorial helps you make your site extra awesome!
/*
* Adds start time to event titles in Month view
*/
function tribe_add_start_time_to_event_title ( $post_title, $post_id ) {
if ( !tribe_is_event($post_id) ) return $post_title;
// Checks if it is the month view, modify this line to apply to more views
if ( !tribe_is_month() ) return $post_title;
$event_start_time = tribe_get_start_time( $post_id );
if ( !empty( $event_start_time ) ) {
$post_title = $event_start_time . ' - ' . $post_title;
}
return $post_title;
}
add_filter( 'the_title', 'tribe_add_start_time_to_event_title', 100, 2 );