Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created January 19, 2017 22:00
Show Gist options
  • Save joshfeck/118f8636d34fb588505fd0b536d12f37 to your computer and use it in GitHub Desktop.
Save joshfeck/118f8636d34fb588505fd0b536d12f37 to your computer and use it in GitHub Desktop.
Adds the event location to the EE4 calendar event. Requires EE4.
function jv_ee_add_location_to_calendar_event( $text, $datetime, $event ) {
if ( $event instanceof EE_Event ) {
$venue = $event->get_first_related( 'Venue' );
if ( $venue instanceof EE_Venue ) {
$venue_name = $venue->name();
$text .= '<span>Location: ' . $venue_name . '</span>';
}
}
return $text;
}
add_filter( 'FHEE__EE_Calendar__get_calendar_events__event_time_html', 'jv_ee_add_location_to_calendar_event', 10, 3 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment