-
-
Save nefeline/6b99a2517c86e5e71bdf0dbbd7c03163 to your computer and use it in GitHub Desktop.
Open Gcal in a new tab
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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