Skip to content

Instantly share code, notes, and snippets.

@LateButEarly
Last active January 7, 2016 14:44
Show Gist options
  • Save LateButEarly/01b30869f5af1fa405d1 to your computer and use it in GitHub Desktop.
Save LateButEarly/01b30869f5af1fa405d1 to your computer and use it in GitHub Desktop.
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