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 the filename_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 header
  • footer.html – Email footer
  • confirmation-user.html – User confirmation of booking
  • confirmation-info-admin.html – Notification to the administrator of a confirmed booking
  • accept-admin.html – Confirmation of booking by administrator
  • cancelled-from-user.html – Notification to the administrator of a user-canceled reservation
  • cancelled-admin.html – Notification to the user of a reservation canceled by an administrator
  • event.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.