Skip to content

Instantly share code, notes, and snippets.

@nefeline
Created January 24, 2018 12:48
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 nefeline/6b99a2517c86e5e71bdf0dbbd7c03163 to your computer and use it in GitHub Desktop.
Save nefeline/6b99a2517c86e5e71bdf0dbbd7c03163 to your computer and use it in GitHub Desktop.
Open Gcal in a new tab
<?php
add_filter( 'tribe_events_ical_single_event_links', 'ph_open_gcal_on_new_tab', 10, 3 );
function ph_open_gcal_on_new_tab( $calendar_links ) {
if ( is_single() && post_password_required() ) {
return;
}
$calendar_links = '<div class="tribe-events-cal-links">';
$calendar_links .= '<a class="tribe-events-gcal tribe-events-button" target="_blank" href="' . Tribe__Events__Main::instance()
->esc_gcal_url( tribe_get_gcal_link() ) . '" title="' . esc_attr__( 'Add to Google Calendar', 'the-events-calendar' ) . '">+ ' . esc_html__( 'Google Calendar', 'the-events-calendar' ) . '</a>';
$calendar_links .= '<a class="tribe-events-ical tribe-events-button" href="' . esc_url( tribe_get_single_ical_link() ) . '" title="' . esc_attr__( 'Download .ics file', 'the-events-calendar' ) . '" >+ ' . esc_html__( 'iCal Export', 'the-events-calendar' ) . '</a>';
$calendar_links .= '</div><!-- .tribe-events-cal-links -->';
return $calendar_links;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment