Skip to content

Instantly share code, notes, and snippets.

@joshfeck joshfeck/example_ical.php Secret
Created Sep 5, 2018

Embed
What would you like to do?
Add an iCal link to the Event Espresso 4 thank you page
<?php
//* Please do NOT include the opening php tag, except of course if you're starting with a blank file
function ee_add_ical_link_thank_you_page($registration) {
add_filter(
'FHEE__EED_Ical__generate_add_to_iCal_button__iCal_type',
function(){
return 'button';
}
);
$output = '<div class="ical">';
if ( $registration instanceof EE_Registration ) {
$ticket = $registration->get_first_related('Ticket');
if ($ticket instanceof EE_Ticket) {
$datetime_ticket = $ticket->get_first_related('Datetime_Ticket');
if ($datetime_ticket instanceof EE_Datetime_Ticket){
$datetime = $datetime_ticket->get_first_related('Datetime');
if ($datetime instanceof EE_Datetime){
$html = 'Add to calendar: ';
$output .= EED_Ical::generate_add_to_iCal_button($html, $datetime);
}
}
}
}
$output .= '</div>';
echo $output;
}
add_action(
'AHEE__thank_you_page_registration_details_template__after_registration_table_row',
'ee_add_ical_link_thank_you_page',
10,
1
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.