This is directly related to a change made in WordPress 7 in the wp_kses sanitization process. I built in a workaround so that legacy templates are still possible, but I can’t cover all possible cases.
It would be helpful if you shared the original template, so I can check my workaround against it – but the major thing is that the new system is less forgiving of errors in the original template.
The specific change in wp_kses is that it normalizes quotes around HTML attributes, forcing them all to use double quotes and disallowing single quotes. That *immediately* breaks most My Calendar legacy templates, so I wrote a workaround that restores the single quotes. But looking at your template, there’s a gap somewhere, and it would help me to know what to look at.
Found a case that still needed to be handled, and I’m shipping an update to address that; let me know if it resolves your case!
I’ve just tried again with My Calendar plugin V3.7.13. The display is better but still suffers from problems when double quotes and single quotes appear in the same template line. Here’s my Main Calendar template:
<div class="event-title mc-pu-titlebar">{title}</div>
<div class="mc-pu-mainpopup-body">
<span class="event-time value-title">{time}{endtime before="<span class='time-separator'> - </span><span class='end-time'>" after="</span>"} on {daterange}</span>
{image before="<div class='mc-event-image'>" after="</div>"}
<div class="mc-pu-desc">
{hcard before="<div class='mc-location'>" after="</div>"}
{description before="<div class='mc-excerpt'>" after="</div>"}
</div>
{link before="<div><p><a class='event-link external' href='" after="'>More event info</a></p></div>"}
</div>
The problems now just concern interpretation of the ‘link’ statement at the end.
I’m honestly not sure that’s a case I’ll be able to handle; but I’ll be looking at it. In the meantime, I’ve written some documentation about migrating from legacy templates to PHP templates:
https://docs.joedolson.com/my-calendar/migrating-from-legacy-templates-to-php-templates/
Ok, I’ve had a look at your migration documentation and I’ve tried using your example calendar.php template code on my test system but although it’s saved inside my theme directory at /your-theme/mc-templates/event/calendar.php it’s not being picked up by the My Calendar plugin – the Main Calendar pop up is still showing the previous corrupt legacy template content. Is there something else that needs to be done to activate the new PHP template?
BTW, I think there’s some errors in your example template code, I suspect the ‘sub-details’ block is intended to be as follows (rather than referencing the image variable):
<div class="sub-details">
$hcard = mc_get_template_tag( $data, 'hcard' );
if ( $hcard ) {
?>
<div class="mc-location">
<?php
mc_template_tag( $data, 'hcard' );
?>
</div>
}
$excerpt - mc_get_template_tag( $data, 'excerpt' );
if ( $excerpt ) {
?>
<div class="mc-excerpt">
<?php
mc_template_tag( $data, 'excerpt' );
?>
</div>
}
</div>
Thanks for catching those errors; now fixed.
And I did leave out an important step… “Turn on PHP Templating”. Take a look at the instructions again…
Ok, I’m making progress now – I’ve migrated my legacy templates into PHP form – that’s a tedious process but hopefully only needed once. I still need to do some proper testing to be sure everything’s ok but it looks promising.
However, one thing I spotted is that your example PHP template code contains errors and doesn’t render properly. I include a modified version below that performs as intended.
<?php
/**
* Template: Single Event, Grid view.
*
* @category Templates
* @package My Calendar
* @author Joe Dolson
* @license GPLv3
* @link https://www.joedolson.com/my-calendar/
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
<div class="mc-v2 <?php mc_event_classes( $data->event, 'calendar' ); ?>">
<span class="event-time value-title">
<?php
mc_template_tag( $data, 'time' );
$endtime = mc_get_template_tag( $data, 'endtime' );
if ( $endtime ) {
?>
<span class='time-separator'> - </span><span class='end-time'>
<?php
mc_template_tag( $data, 'endtime' );
?>
</span>
<?php
}
?>
<?php
$image = mc_get_template_tag( $data, 'image' );
if ( $image ) {
?>
<div class="mc-event-image">
<?php
mc_template_tag( $data, 'image' );
?>
</div>
<?php
}
?>
<div class="sub-details">
<?php
$hcard = mc_get_template_tag( $data, 'hcard' );
if ( $hcard ) {
?>
<div class="mc-location">
<?php
mc_template_tag( $data, 'hcard' );
?>
</div>
<?php
}
?>
<?php
$excerpt = mc_get_template_tag( $data, 'excerpt' );
if ( $excerpt) {
?>
<div class="mc-excerpt">
<?php
mc_template_tag( $data, 'excerpt' );
?>
</div>
<?php
}
?>
</div>
Thanks for noting that; fixed. And this time I actually ran the code, to verify…
Everything’s been a bit rushed this week.
Ok, I’ve now migrated my legacy grid, mini and details templates to PHP form and they all look and behave as they did before the WP7 update. However I spotted that the Main Calendar, when operating in List mode, looked different – the backgrounds of event titles were not showing their category colours. Now I hadn’t used a list template previously, the built-in core template was sufficient for my needs. But on further investigation I noticed that the core template generates HTML code for event titles as follows:
<h3 class="event-title summary">Event Title Here</h3>
whereas the default list.php template generates:
<h2 class="mc-title">Event Title Here</h2>
Consequently the My Calendar CSS statement that assigned the category colour to elements belonging to class event-title was being ignored. I’ve now tweaked the PHP template for list to match the core template and all is well again.
Well, that sounds like an oversight on my part. Thanks for noting it! I’ll get that fixed in the core templates.