Created
November 16, 2016 17:21
-
-
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.
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
<?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: ' . $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