WPCal.io - Help Center

Common questions and support documentation

We're
by
All CollectionsGeneralHow to customise calendar event content template in PHP?

Applicable to v0.9.5.0+

To customise email templates check - How to customise email templates in PHP?
In this article -

Calendar content customisation template using PHP

As the calendar invitation mails are sent by the calendar app, e.g Google Calendar, we have control only over the event name (summary) and its description. If you do not dabble with code, we recommend using the services of a PHP developer who has good knowledge in WordPress to do the customisations. The developer should copy the original desired templates from the plugin and place it in child theme folder and modify it based on your needs.

List of templates to customise

All calendar event content templates can be found in the [WP Site root]/wp-content/plugins/wpcal/templates/calendar_events folder.

common_calendar_event_plain.php


How to customise the calendar content template using php?

Make sure the 'Invitee notification type' option of the event type is set to 'Calendar invitation' and that the 'Add booking to...' calendar (under WPCal.io › Settings › Calendars) is added.

In this article we gonna customise common_calendar_event_plain.php template

Locate the plugin's calendar event content template in wpcal plugin's templates folder.
[WP Site root]/wp-content/plugins/wpcal/templates/

in this case the template we going to customise is calendar_events/common_calendar_event_plain.php

Full path to the desired template file is
[WP Site root]/wp-content/plugins/wpcal/templates/calendar_events/common_calendar_event_plain.php


It is highly recommended to place the overriding (customised template) file inside a child theme so that it will not get removed during theme updates.

For more info please check - How to setup WordPress child theme?
In our case, the child theme is twentytwentyone-child


Place the copied file in the child theme by creating a 'wpcal' folder as mentioned below
[WP Site root]/wp-content/themes/twentytwentyone-child/wpcal/calendar_events/common_calendar_event_plain.php


To verify whether you have successfully overridden the template file, go to WP Admin › WPCal.io › Settings › General




Once your customised template displays in the list, you are all set to do the customization.

Now you can customise the file [WP Site root]/wp-content/themes/twentytwentyone-child/wpcal/calendar_events/common_calendar_event_plain.php and make sure to set appropriate values for $summary and $descr_txt before the following line which can be located near the end of file.

$template_result = ['summary' => $summary, 'descr' => $descr_txt];
We strongly recommend you to do the email customisations in the staging site and once all changes are done and tested, deploy it to the production site.

Please watch out for calendar event content template changes in each WPCal updates and sync the changes in your customised template file. As always do the changes in a staging site and verify it before deploying it to production.

Still need help? Contact Us
Did this answer your question?