Skip to content

Instantly share code, notes, and snippets.

@andrasguseo
Last active May 2, 2017 22:44
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 andrasguseo/4a0ade5be8495c5dac34fc5a17f6dc59 to your computer and use it in GitHub Desktop.
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
<?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