Last active
May 2, 2017 22:44
-
-
Save andrasguseo/4a0ade5be8495c5dac34fc5a17f6dc59 to your computer and use it in GitHub Desktop.
MT | ET | Add a + iCal link to each ticket in the tickets email
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 | |
/** | |
* Adds a + iCal link to each ticket in the tickets email | |
* | |
* @see tribe_tickets_ticket_email_ticket_bottom | |
*/ | |
function tribe_add_ical_to_email( $order ) { | |
// Temporarily change global post. | |
$original_post = $GLOBALS['post']; | |
$GLOBALS['post'] = get_post( $order['event_id'] ); | |
printf( | |
'<a class="tribe-events-ical tribe-events-button" href="%1$s" title="%2$s">%3$s</a>', | |
esc_url( tribe_get_single_ical_link() ), | |
esc_attr__( 'Download .ics file', 'the-events-calendar' ), | |
esc_html__( 'iCal Export', 'the-events-calendar' ) | |
); | |
// Change post back. | |
$GLOBALS['post'] = $original_post; | |
} | |
add_action ( 'tribe_tickets_ticket_email_ticket_bottom', 'tribe_add_ical_to_email', 101, 1 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment