Skip to content

Instantly share code, notes, and snippets.

@cliffordp
Last active April 20, 2017 22:15
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 cliffordp/f9dfbb225d79fddd7154fa33ba25166a to your computer and use it in GitHub Desktop.
Save cliffordp/f9dfbb225d79fddd7154fa33ba25166a to your computer and use it in GitHub Desktop.
Add single event Google Calendar and iCalendar links to the bottom of tickets emails
<?php
/**
* Add single event Google Calendar and iCalendar links to the bottom of tickets emails
* For https://theeventscalendar.com/support/forums/topic/rsvp-confirmation-email-with-ics-attachment/
*
* From https://gist.github.com/cliffordp/f9dfbb225d79fddd7154fa33ba25166a
* Alternative if you only want iCal/.ics file link and not Google Calendar link: https://gist.github.com/cliffordp/f6b4669f2d1059f288d0583cc50a2944
**/
add_action( 'init', 'cliff_cal_links_on_ticket_emails' );
function cliff_cal_links_on_ticket_emails() {
if ( ! function_exists( 'tribe' ) || ! class_exists( 'Tribe__Events__iCal' ) ) {
return;
}
add_action( 'tribe_tickets_ticket_email_ticket_bottom', array( tribe( 'tec.iCal' ), 'single_event_links' ), 50 );
add_action( 'tribe_tickets_ticket_email_styles', 'cliff_cal_links_ticket_email_styling' );
}
function cliff_cal_links_ticket_email_styling() {
echo '.tribe-events-cal-links .tribe-events-gcal { padding-right: 20px; }';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment