Home › Forums › Ticket Products › Event Tickets Plus › Adding custom field to email.php on Event Tickets
- This topic has 9 replies, 4 voices, and was last updated 9 years, 6 months ago by
Orla.
-
AuthorPosts
-
September 21, 2016 at 9:25 am #1166965
Orla
ParticipantThis is an update to this ticket: https://theeventscalendar.com/support/forums/topic/acf-display-in-email-template/#post-1152062
Aim: Add a custom field with the registration URL of the event into the Ticket Email.
Here is the code:
<h2>Webinar Details:</h2> <?php $webinarURL = get_field( 'webinarLink' ); if( $webinarURL ) { echo '<a href="' . $webinarURL . '" target="_blank">WEBINAR REGISTRATION</a>'; } else { echo 'empty'; } ?>This works for projects but when I try to implement it on the following template: /plugins/event-tickets/src/views/event-tickets/tickets/email.php I am constantly getting:
Webinar Details
EmptyThe webinarLink field is definitely filled in with the same url on both the project page and the event page.
I know Geoff was able to get it working on his end – I am mystified as to why I cannot get it working. It just doesn’t seem to be able to pick up the custom field but the if statement is working.
Do you have any idea why this is happening?
Kind Regards,
OrlaSeptember 22, 2016 at 8:59 am #1167424Nico
MemberHi there Orla,
Thanks for getting in touch and for the detailed description of this issue!
I just tried it locally and indeed wasn’t working for me either. I found that it’s necessary to add the event ID to the get_field function, also the field identifier should be all lower case (although I think ACF handles this gracefully). So the final code that’s working on my side is:
Webinar Details:
ID ) ) {
echo 'WEBINAR REGISTRATION';
} else {
echo 'empty';
}
?>
Maybe Geoff was placing the code in a different part of the template that had the global $post_id set? Not sure about it.
One more thing, it’s ok to actually try this in /plugins/event-tickets/src/views/event-tickets/tickets/email.php, but as it’s a plugin file it will get overwritten in future updates. To be safe create a template override of the file (as explained in our themer’s guide) and add the custom code there.
Please give this a try and let me know about it,
Best,
NicoSeptember 23, 2016 at 3:08 am #1167825Orla
ParticipantThis reply is private.
September 23, 2016 at 12:45 pm #1168106Nico
MemberThis reply is private.
September 27, 2016 at 2:49 am #1169108Orla
ParticipantThis reply is private.
September 27, 2016 at 2:25 pm #1169513Nico
MemberThis reply is private.
September 28, 2016 at 7:12 am #1169776Orla
ParticipantThis reply is private.
September 29, 2016 at 6:25 am #1170317Nico
MemberThis reply is private.
October 21, 2016 at 9:35 am #1180647Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Adding custom field to email.php on Event Tickets’ is closed to new replies.
