Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
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