Created
August 16, 2019 23:03
-
-
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.
This file contains 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 | |
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>, ' . $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