Skip to content

Instantly share code, notes, and snippets.

@quasel
Forked from bordoni/functions.php
Created January 5, 2019 12:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save quasel/72e8606f3a2ce74f8877f9164316465f to your computer and use it in GitHub Desktop.
Save quasel/72e8606f3a2ce74f8877f9164316465f 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment