Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Created August 16, 2019 23:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joshfeck/b1020693f2ca98043bffbd4206d7ded0 to your computer and use it in GitHub Desktop.
Save joshfeck/b1020693f2ca98043bffbd4206d7ded0 to your computer and use it in GitHub Desktop.
Add venue information to the Event Espresso 4 calendar tooltip. You can add this code to a functions plugin or, if available, into your WordPress child theme's functions.php file.
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
add_filter(
'FHEE__EE_Calendar__get_calendar_events__tooltip_reg_btn_html',
'my_custom_calendar_tooltip_add_venue',
10,
3
);
function my_custom_calendar_tooltip_add_venue(
$original_output,
$event,
$datetime
) {
$venue_html = '';
if($event instanceof EE_Event) {
$venues = $event->venues();
if(is_array($venues)) {
$venue = reset($venues);
if( $venue instanceof EE_Venue ){
$venue_html = '<div class="venue-tooltip">';
$venue_html .= '' !== $venue->name() ? '<span>' . $venue->name() . '</span><br>' : '';
$venue_html .= '' !== $venue->address() ? '<span>' . $venue->address() . '</span><br>' : '';
$venue_html .= '' !== $venue->city() ? '<span>' . $venue->city() . '</span>' : '';
$venue_html .= '' !== $venue->state() ? '<span>,&nbsp;' . $venue->state() . '</span>' : '';
$venue_html .= '</div>';
return $venue_html . $original_output;
}
}
}
return $original_output;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment