Email templates
The plugin uses email templates for communication, in which it is possible to use several language templates at the same time. It loads the one that corresponds to the current language.
The plugin first looks for email templates in the (child) theme used by the page, in the book-an-appointment/emails/<language>/
folder. If it is found here, it will be used from here, if not, it will look for the template in the templates/emails/<language>/
folder in the plugin folder.
Warning! A possible update will overwrite the (possibly modified) template in the plugin folder. It’s a good idea to copy the templates from the plugin’s folder to the „book-an-appointment” folder in the (child) theme, and then edit them as desired.
Templates are basically HTML files in which the plugin creates the content of the email by simply substituting variables. However, there is some control in the templates:
-
<!-- include [filename_and_extension] -->
Loads thefilename_and_extension
file in place of the link – from the same folder. (The default template reads the letterhead and footer this way.) -
<!-- if phone --> If the phone variable exists and its value is not empty <!-- else phone --> else <!-- endif phone -->
The template simply replaces the referenced content with the value of the variable during operation.
Eg. <input name="phone" value="(10) 555-1234" />
in the case of the following template detail:
<div>Your phone number: <!-- phone --></div>
write the following in the template:
<div>Your phone number: (10) 555-1234</div>
If the value of the variable is an array, it does not replace the value of the array, but loads the variable_name.html
template from the same folder and replaces the values of the array for each element in it. (For example, the days
variable in the default template behaves this way.)
Templates and their use
header.html
– Email headerfooter.html
– Email footerconfirmation-user.html
– User confirmation of bookingconfirmation-info-admin.html
– Notification to the administrator of a confirmed bookingaccept-admin.html
– Confirmation of booking by administratorcancelled-from-user.html
– Notification to the administrator of a user-canceled reservationcancelled-admin.html
– Notification to the user of a reservation canceled by an administratorevent.html
– Template for an ICS file sent as an email attachment
The default links that can be used in the templates are shown in the default templates.