Hello Stephen,
Two—kind of—related questions
1 – Is there a way to display the category of an event inside the tooltips that come with the event_map shortcode?
2 – What about showing the category in the full calendar view (eo_fullcalendar), next to each event title or, alternatively, inside the tooltip of each event?
I searched here http://docs.wp-event-organiser.com/shortcodes/events-map/ for 1;
and here http://codex.wp-event-organiser.com/hook-eventorganiser_event_tooltip.html for 2, but I still don’t know how to get the category in either case.
I’ll also take the opportunity to thank you for the great support!!

Duarte Lourenco
Hi Duarte,
Yes, both are possible. You’ve found the correct link for (2), just be aware that changes will only take effect one the cache is cleared (i.e. an event is updated). Here’s how to get the event categories in that case
add_filter( 'eventorganiser_event_tooltip', 'my_callback_function', 10, 4 );
function my_callback_function( $description, $event_id, $occurrence_id, $post ){
//Gets an array of event categories for this event
$categories = get_the_terms( $event_id, 'event-category' );
//Change first value and return it
return $description;
};
$categories
in the above is an array of term objects. And you can get the name from a term object with:
$term->name;
See the examples on this page for more details: https://codex.wordpress.org/Function_Reference/get_the_terms
Something similar can be done for the event map, but note that the context is the venue not an event. As such you have potentially multiple events, so you would need to loop through them:
function my_change_event_map_tooltip( $tooltip_content, $venue_id, $events ){
foreach( $events as $event ){
$categories = get_the_terms( $event->ID, 'event-category' );
}
return $tooltip_content;
}
add_filter( 'eventorganiser_event_map_tooltip', 'my_change_event_map_tooltip', 10, 3 );

Stephen Harris
Stephen,
I’m sorry, but I failed to make it work. I couldn’t apply those examples to our case, as everything I tried returned the dreaded blank page or didn’t do anything…
Can I ask you for more details on how to return the category name on that first example of yours?
Ty

Duarte Lourenco
Here’s an example:
add_filter( 'eventorganiser_event_tooltip', 'my_callback_function', 10, 4 );
function my_callback_function( $description, $event_id, $occurrence_id, $post ){
$description .= get_the_term_list(
$event_id,
'event-category',
'<p> This event is categorised: ' ,
', ',
'</p>'
);
return $description;
};
I’ve used get_the_term_list()
as it creates a nice list of categories (with links) automatically.

Stephen Harris
Hello Sephen
Thank you.
And what if I want to have the categories next to the title of the event, on the calendar view? (not in the tooltip)
Taking the demo page, http://wp-event-organiser.com/demo/calendar/ , imagine a category name displaying right next to “Fortnightly event”

Duarte Lourenco
You can use the eventorganiser_fullcalendar_event
hook for that. As above, please note that the calendar is cached.
add_filter( 'eventorganiser_fullcalendar_event', 'my_fc_callback_function', 10, 3 );
function my_fc_callback_function( $event, $event_id, $occurrence_id ){
$terms = get_the_term_list(
$event_id,
'event-category',
' (' ,
', ',
')'
);
$event['title'] .= strip_tags( $terms );
return $event;
};

Stephen Harris