Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Reposition the The Events Calendar gCal and iCal buttons before the content.
/**
* Reposition the The Events Calendar gcal and ical buttons before the content.
*
* https://wordpress.org/plugins/the-events-calendar/
*/
remove_action( 'tribe_events_single_event_after_the_content', array( 'Tribe__Events__iCal', 'single_event_links' ) );
add_action( 'tribe_events_single_event_before_the_content', 'theme_reposition_calendar_buttons' );
function theme_reposition_calendar_buttons() {
// don't show on password protected posts
if ( is_single() && post_password_required() ) {
return;
}
echo '<div class="tribe-events-cal-links">';
echo '<a class="tribe-events-gcal tribe-events-button" href="' . Tribe__Events__Main::instance()->esc_gcal_url( tribe_get_gcal_link() ) . '" title="' . esc_attr__( 'Add to Google Calendar', 'tribe-events-calendar' ) . '">+ ' . esc_html__( 'Google Calendar', 'tribe-events-calendar' ) . '</a>';
echo '<a class="tribe-events-ical tribe-events-button" href="' . esc_url( tribe_get_single_ical_link() ) . '" title="' . esc_attr__( 'Download .ics file', 'tribe-events-calendar' ) . '" >+ ' . esc_html__( 'iCal Export', 'tribe-events-calendar' ) . '</a>';
echo '</div><!-- .tribe-events-cal-links -->';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment