Every calendar view template has a “before” and “after” hook that allows you to insert custom HTML either above or below the template, respectively. For example, if you wanted to include a button after the month/mobile-events.php
template, we would use the action tribe_template_after_include:events/v2/month/mobile-events
. Our action would then look something like this:
add_action( 'tribe_template_after_include:events/v2/month/mobile-events', function( $file, $name, $template ) {
echo '<button>My Button</button>';
}, 10, 3 );
…where $file
is a string of the complete template path, $name
is an array of the parts of the template name, and $template
is the current instance of the Tribe__Template
class. You probably won’t need to work with any of these most of the time.
As another example, if you wanted to include a link before the view selector (the template components/events-bar/views.php
), we would use the action tribe_template_before_include:events/v2/components/events-bar/views
. Our action would then look something like this:
add_action( 'tribe_template_before_include:events/v2/components/events-bar/views', function( $file, $name, $template ) {
echo '<a href="#">My Link</a>';
}, 10, 3 );
These before and after hooks allow users another way to hook into and modify the templates without making changes to the templates themselves.