Skip to content

Instantly share code, notes, and snippets.

@stephenh1988
Created November 8, 2012 18:45
Show Gist options
  • Save stephenh1988/4040699 to your computer and use it in GitHub Desktop.
Save stephenh1988/4040699 to your computer and use it in GitHub Desktop.
Include venue name in an event's calendar tooltip
/**
* Requires Event Organiser 1.6+
*
* Adds the venue's name to the content appearing in the tooltip when hovering over an event in fullcalendar
* @uses eventorganiser_event_tooltip filter.
*
* The filter passes 4 objects: the content of the toolip, the post ID of the event, the occurrence ID
* of the event and the post object (the last one probably won't often bed needed).
* In this example we just need the first two.
*/
add_filter('eventorganiser_event_tooltip', 'my_event_tooltip_content', 10,2);
function my_event_tooltip_content( $description, $post_id ){
$venue_id = eo_get_venue($post_id);
if( $venue_id ){
//Event has a venue, append this to the event description.
$description = 'This event is at '.eo_get_venue_name($venue_id).'</br></br>'.$description;
}
return $description;
}
@epsilon42
Copy link

This is a bit late, but to anyone coming across this code snippet now and find that the tooltip doesn't show the venue after adding this to your functions.php, you will need to update the event before it will take effect as the calendar is cached.

Info taken from this post:
https://wp-event-organiser.com/forums/topic/add-more-details-to-calendar-tooltip/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment