Version 3.5 of My Calendar introduced support for PHP-based templates. When enabled, these templates replace the entirety of the previous templating system.

My Calendar’s default templates are found at /my-calendar/mc-templates/. To use PHP templates in your site, copy the desired file into your theme, using the same file directory path.

For example, the template at /my-calendar/mc-templates/event/calendar.php is the template used to display event content inside the modal or pop-up in the calendar grid view. To customize this template, create /mc-templates/event/ in your theme directory and place a copy of calendar.php in that directory. You can then modify the template to your needs.

Template Functions

Templates use two different sets of functions. The function mc_template_tag( $data, $tag ) fetches any value in the event templates array. Any value in the template tag index can be fetched using this function. To get the value of {link_title}, use mc_template_tag( $data, 'link_title' ).

To allow backwards compatibility for the layouts used in My Calendar through version 3.4, there is also a collection of functions that add the markup used in those layouts.

  • mc_template_time( $data, $format ) – Event date and time.
  • mc_template_image( $data, $format ) – Event featured image.
  • mc_template_description( $data, $format ) – Event description.
  • mc_template_excerpt( $data, $format ) – Event excerpt.
  • mc_template_location( $data, $format ) – Event location.
  • mc_template_access( $data, $format ) – Event accessibility features.
  • mc_template_link( $data, $format ) – External link.
  • mc_template_registration( $data, $format ) – Registration and ticketing information.
  • mc_template_author( $data, $format ) – Author information.
  • mc_template_host( $data, $format ) – Host information.
  • mc_template_share( $data, $format ) – Share links.
  • mc_template_return( $data, $format ) – Back to calendar link.

These functions use essentially the same markup as versions of My Calendar before 3.5 used, and they respect the settings configured at My Calendar > Settings > Display, so that if you had the description disabled on a template, it will continue to be disabled.


The $data variable is an array containing references for the event, template tags, and view information such as the view type (grid, card, list) or the time (month, day, week, single). Type and time information may not always be present, but the event object, tags array, and template string should always be available.

$data  = array(
'event' => $event,
'tags' => $tags,
'template' => $template,
'type' => $type,
'time' => $time,

The $format variable is a string indicating which view is being rendered. This only makes a difference in a few cases, so it can usually be omitted. The default value is ‘calendar’, which is the grid pop-up view.

Support for Legacy Templates inside PHP Templates

If you have an old template or a template fragment that you would like to continue to use, you can do that. There’s a template drawing function that can be used inside PHP templates:

mc_template( $data['tags'], $template, $format )

$template is a variable that holds your template string.

Advantages of PHP Templates

The major advantage to these over the legacy template system is support for logic. The template parser never supported any sophisticated logic, so you couldn’t adjust your templates on the fly based on event characteristics.

The other advantage is that none of the template data is stored in the database; it’s all file based.