Dear Stephen,
how can I add the ‘organiser’ (wordpress user who created the event) to the tooltip? I only need to show this. No description, no time, (maybe no title).
How can I add this feature without loosing it after updating the plugin?
Thank you in advance!
Best regards,
Martin
Denise Wunder
Which tooltip? The calendar? You can use the eventorganiser_event_tooltip
filter: http://codex.wp-event-organiser.com/hook-eventorganiser_event_tooltip.html
To get the organiser:
$organiser_id = (int) get_post($event_id)->post_author;
$organiser = get_userdata( $organiser_id );
If you mean the venue map, that would be trickier: the tooltip is associated with a venue, not the map. You can use the eventorganiser_venue_tooltip
filter (http://codex.wp-event-organiser.com/hook-eventorganiser_venue_tooltip.html) but you would need to determine how you would get the intended event ID From the venue ID.
Stephen Harris
Dear Stephen,
you are right, I meant the calendar tooltip, not the venue tooltip.
Unfortunately, I am not so skilled in PHP coding. Could you give me a more detailed description of what to do? I just need to see the ‘organiser’.
Thanks so much!
Denise Wunder
Hi Martin,
The following in a theme’s functions.php or a custom plugin should do it:
<?php
add_filter( 'eventorganiser_event_tooltip', 'my_event_calendar_tooltip_content', 10, 4 );
function my_event_calendar_tooltip_content( $description, $event_id, $occurrence_id, $post ){
$organiser_id = (int) $post->post_author;
$organiser = get_userdata( $organiser_id );
$organiser_name = $organiser->display_name;
//Change first value and return it
return "Content here... organiser: $organiser_name";
};
?>
Please note, you’ll need to update an event before the changes to take effect.
-
This reply was modified 7 years, 2 months ago by Stephen Harris.
-
This reply was modified 7 years, 2 months ago by Stephen Harris.
Stephen Harris
Hi Stepehn,
I tried both methods.
First one was to copy the code at the bottom of my themes function.php file without “<?php” on top.
Second method was to copy the code in a blank php file with “<?php” on top into the wordpress plugin folder.
Nothing worked, even though I’ve always cleared the cache by updating an event.
Could it be that I need to have installed EO Pro? So far I’ve only bought the license, but did not installed it, because i only needed your support 😉
Greetings,
Martin
Denise Wunder
There were a few errors in my original code snippet, which I’ve since corrected. Pro is not required.
The code should go inside <?php ... ?>
tags (included in the snippet).
One easy way to do this is to create a file: .../wp-content/mu-plugins/calendar-tooltip.php
and paste the entire contents of that snippet (including the <?php ... ?>
tags) into it.
Stephen Harris
Absolutely fantastic, Stephen!
Thank you again!
Denise Wunder