Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created November 16, 2016 17:21
Show Gist options
  • Save joshfeck/501a66f238e74db316c5d82f54e37f63 to your computer and use it in GitHub Desktop.
Save joshfeck/501a66f238e74db316c5d82f54e37f63 to your computer and use it in GitHub Desktop.
Adds the event location to the EE4 calendar tooltip. Requires EE4 and setting Display Attendee Limits to Yes in the calendar's Advanced Settings.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function jf_ee_add_location_to_calendar_qtip( $text, $datetime ) {
if ( $datetime instanceof EE_Datetime ) {
$event = $datetime->get_first_related( 'Event' );
if ( $event instanceof EE_Event ) {
$venue = $event->get_first_related( 'Venue' );
if ( $venue instanceof EE_Venue ) {
$venue_name = $venue->name();
$text .= '<br>Location:&nbsp;' . $venue_name;
}
}
}
return $text;
}
add_filter( 'FHEE__EE_Calendar__tooltip_datetime_available_spaces', 'jf_ee_add_location_to_calendar_qtip', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment