Tribe__Events__iCal::maybe_add_link()
Generates the markup for the “iCal Import” link for the views.
Source
File: src/Tribe/iCal.php
public function maybe_add_link() { if ( ! $wp_query = tribe_get_global_query_object() ) { return; } /** * A filter to control whether the "iCal Import" link shows up or not. * * @param boolean $show Whether to show the "iCal Import" link; defaults to true. */ $show_ical = apply_filters( 'tribe_events_list_show_ical_link', true ); if ( ! $show_ical ) { return; } if ( tribe_is_month() && ! tribe_events_month_has_events() ) { return; } if ( ! tribe_is_month() && ( is_single() || empty( $wp_query->posts ) ) ) { return; } $tec = Tribe__Events__Main::instance(); $view = $tec->displaying; if ( defined( 'DOING_AJAX' ) && DOING_AJAX && isset( $wp_query->query_vars['eventDisplay'] ) ) { $view = $wp_query->query_vars['eventDisplay']; } /** * Allow for customization of the iCal export link "Export Events" text. * * @param string $text The default link text, which is "Export Events". */ $text = apply_filters( 'tribe_events_ical_export_text', esc_html__( 'Export Events', 'the-events-calendar' ) ); $title = esc_html__( 'Use this to share calendar data with Google Calendar, Apple iCal and other compatible apps', 'the-events-calendar' ); printf( '<a class="tribe-events-ical tribe-events-button" title="%1$s" href="%2$s">+ %3$s</a>', $title, esc_url( tribe_get_ical_link() ), $text ); }