The template option under the ‘Bookings’ tab in the plug-in settings page allows you to select, and preview, various templates to give your e-mails more visual appeal.
If the default templates are not to your taste, or you want a more integrated look the Event Organiser API allows the default templates to be extended.
Custom Templates
And its heart an e-mail template is simply a php file that lives in your theme (preferably child theme) with a particular comment header that allows Event Organiser to recognise it.
For the template to function correctly it must
- Contain a comment at the top of the form ‘Event Organiser Email Template: [Template Name]’ (see the examples)
- A call to the function
eventorganiser_email_content()
where you want the e-mail content to be displayed
The most basic of all templates would be:
<?php
/**
* Event Organiser Email Template: My Template Name
*/
?>
<?php eventorganiser_email_content(); ?>
Which is very basic and boring. A more interesting example is:
<?php
/**
* Event Organiser Email Template: Purple
*/
?>
<div style="background: #f0f0f0; padding: 8px 10px;">
<div style="background: #9c21a4; width: 550px; border: 1px solid #ccc; margin: 0 auto;border-radius:5px;">
<div id="eo-email-header" style="height:50px;"></div>
<div id="eo-email-content" style="background: #fff;padding: 8px 15px;">
<?php eventorganiser_email_content(); ?>
</div>
<div id="eo-email-footer" style="background: #9c21a4; height:50px;position:relative;">
<div style="font-size:10px;vertical-align:text-bottom;width:100%;text-align:center;position:absolute;bottom:0;">
<?php echo __( 'Powered by', 'eventorganiserp' ) .' <a href="http://wp-event-organiser.com">Event Organiser</a>'; ?>
</div>
</div>
</div>
</div>
Tips:
- You can include images in the template, but you must use an absolute path to a hosted (i.e. not local image).
- Styling must be done in-line – e-mails do not support stylesheets
- Excessive use of images will increase the size of the e-mail, and may make sending the e-mail slow.
- What styling is supported in e-mails varies between e-mail clients – the best advice is to keep in basic.