Skip to content

Instantly share code, notes, and snippets.

@bordoni
Created February 5, 2015 04:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save bordoni/439bd58bbfbb7db3454b to your computer and use it in GitHub Desktop.
Save bordoni/439bd58bbfbb7db3454b to your computer and use it in GitHub Desktop.
How to add the Venue on The Events Calendar Month Tooltip
<?php
/*
* If you already have something in your functions.php, please remove these first few lines
*/
function tec_forum_939516( $json, $event, $additional ){
$venue = tribe_get_venue_id( $event );
if ( $venue ){
$json['venue'] = $venue;
$json['venue_link'] = tribe_get_venue_link( $venue, false );
$json['venue_title'] = tribe_get_venue( $venue );
}
return $json;
}
add_filter( 'tribe_events_template_data_array', 'tec_forum_939516', 10, 3 );
<?php
// File: /tribe-events/month/tooltip.php
/**
*
* Please see Single_Event.php in this directory for detailed instructions on how to use and modify these templates.
*
*/
?>
<script type="text/html" id="tribe_tmpl_tooltip">
<div id="tribe-events-tooltip-[[=eventId]]" class="tribe-events-tooltip">
<h4 class="entry-title summary">[[=title]]</h4>
<div class="tribe-events-event-body">
<div class="duration">
<abbr class="tribe-events-abbr updated published dtstart">[[=dateDisplay]] </abbr>
</div>
[[ if(imageTooltipSrc.length) { ]]
<div class="tribe-events-event-thumb">
<img src="[[=imageTooltipSrc]]" alt="[[=title]]" />
</div>
[[ } ]]
[[ if(excerpt.length) { ]]
<p class="entry-summary description">[[=raw excerpt]]</p>
[[ } ]]
[[ if(venue) { ]]
<p class="entry-venue">Venue: <a href="[[=venue_link]]">[[=venue_title]]</a></p>
[[ } ]]
<span class="tribe-events-arrow"></span>
</div>
</div>
</script>
@mike-weiner
Copy link

I have a Wordpress Plugin you can install from Wordpress.org (https://wordpress.org/plugins/display-event-locations-tec/#description) or from Github (https://github.com/mike-weiner/display-event-locations-tec) that will accomplish this same change. Because it is within a plugin, you can continue to update your theme(s) as well!

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