-
-
Save stephenh1988/4040699 to your computer and use it in GitHub Desktop.
/** | |
* 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; | |
} |
The lack of the opening <?php threw me for a while, until I noticed it was missing.
On https://wordpress.org/support/topic/venue-map-tooltip-how-do-i-link-upcoming-events-to-the-event-page?replies=6, there was the answer.
"you put the code above not in its own php file, but add it to the bottom of the functions.php file in your themes folder."
I found you can do it with a PHP include statement as opposed to actually putting the code in the functions file copied to a child theme. Without the <?php at the top of the file, including causes all sorts of havoc.
I have put this in my functions.php in a child theme and it doesn't seem to work.
Also, as shown at the top of http://docs.wp-event-organiser.com/shortcodes/calendar/ I would like to get the tooltips on recurring events to say something like "Every Thursday, 7:00pm - 9:00pm" instead of the individual dates.
My site is http://pinkdancecalendar.info
My functions.php looks like this:
'.$description; } return $description; ``` }
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/
And what do you do with this file? I put it in a child theme directory, but nothing happens. There must be more to it than just creating the file. I don't see any instructions in http://codex.wp-event-organiser.com/hook-eventorganiser_event_tooltip.html