MT - TEC & TEC PRO - Add recurrence text everywhere the event start/end date/time details are displayed via tribe_events_event_schedule_details()
<?php
/**
* MT - TEC & TEC PRO - Add recurrence text everywhere the event start/end date/time details are displayed via tribe_events_event_schedule_details()
* such as via PRO's Advanced List Widget, like this: https://cl.ly/411q3Z1c0K2G
*
* from https://gist.github.com/cliffordp/375d6b997226fb1da3ef2494f59d98d6
*
* @return string
*/
function cliff_add_recurrence_text_to_schedule_details( $schedule, $event_id ) {
$addl_html = '';
if ( function_exists( 'tribe_get_recurrence_text' ) && tribe_is_recurring_event( $event_id ) ) {
$recur_text = tribe_get_recurrence_text( $event_id );
// adds <p> tags, which are hidden via CSS in the Advanced List Widget -- /wp-content/plugins/events-calendar-pro/src/resources/css/widget-calendar-full.css?ver=4.4.3 -- so let's swap with span tags
$recur_text = str_replace( '</p>', '</span>', $recur_text );
$recur_text = str_replace( '<p>', '<span>', $recur_text );
// could even prepend $recur_text with something like 'Reoccurs as follows: '
if ( ! empty( $recur_text ) ) {
$addl_html .= PHP_EOL;
$addl_html .= sprintf( '<div class="tribe_events_event_schedule_details-tribe_get_recurrence_text" style="font-style: italic">%s</div>', $recur_text );
$addl_html .= PHP_EOL;
}
}
return $schedule . $addl_html;
}
add_filter( 'tribe_events_event_schedule_details', 'cliff_add_recurrence_text_to_schedule_details', 10, 2 );