casewebman
Forum Replies Created
-
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.
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>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.phpit’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>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.
Hi Joe, I can now confirm that v3.7.3 fixes this issue. Thanks for sorting this out.
Hi Joe, I’ve now updated to My Calendar v3.7.2 on my test system and the mini calendar nav buttons now work ok – no more nulls – thanks for the bug fix, BUT the main calendar problem still persists – ie. the nav buttons work until you use the jump option.
To recap, when the ‘Go’ button is clicked to jump to any month the selected month is displayed but the console reports:
“mcjs.min.js?ver=3.7.2:1 Uncaught (in promise) NoModificationAllowedError: Failed to execute ‘insertAdjacentHTML’ on ‘Element’: The element has no parent. at mcjs.min.js?ver=3.7.2:1:3866”.
Up to this point, clicking the nav buttons has the desired effect. But after this, clicking any of the nav buttons has no apparent effect at all. For info, the following is the code generated on my test system for the v3.7.2 jump option. I note there is no data-href attribute for the Go button merely the URL for the main calendar page as the value of the action attribute of the form element. Is the omission of the data-href from the Go button the root cause of the problem?
<div class="my-calendar-date-switcher">
<form class="mc-date-switcher" action="http://nova/blog/calendar/" method="get">
<div>
<input type="hidden" name="cid" value="my-calendar" /> <label class="maybe-hide" for="my-calendar-month">Month</label>
<select id="my-calendar-month" name="month">
<option value='1' selected='selected'>January</option>
<option value='2'>February</option>
<option value='3'>March</option>
<option value='4'>April</option>
<option value='5'>May</option>
<option value='6'>June</option>
<option value='7'>July</option>
<option value='8'>August</option>
<option value='9'>September</option>
<option value='10'>October</option>
<option value='11'>November</option>
<option value='12'>December</option>
</select>
<label class="maybe-hide" for="my-calendar-year">Year</label>
<select id="my-calendar-year" name="yr">
<option value="2019">2019</option>
<option value="2020">2020</option>
<option value="2021">2021</option>
<option value="2022">2022</option>
<option value="2023">2023</option>
<option value="2024">2024</option>
<option value="2025">2025</option>
<option value="2026" selected='selected'>2026</option>
</select>
<input type="submit" class="button" value="Go" />
</div>
</form>
</div>Hi Joe, thanks for investigating. I look forward to trying your next release.
I’ve now tried a default theme on my test site (I picked the Twenty Twenty theme) and both the main calendar and mini calendar problems persist.
I also tried flushing both server side and client side caches but again the problems persist.
You raise the question of whether data-href attributes are present in the code – on the test site (My Calendar v3.7.1), for the Main Calendar, with our normal theme, the Go button has NO data-href attribute. The code is:
<input type="submit" class="button" value="Go" />However, the nav buttons DO have data-href attributes, for example the code for the Previous button is:
<li class="my-calendar-prev">
<button type="button" class="mc-navigation-button" id="mc_previous_my-calendar" data-href="http://nova/blog/calendar/?cid=my-calendar&dy&month=12&time=month&yr=2025">
<span class="mc-icon" aria-hidden="true"></span>
Previous
</button>
</li>For the one month mini calendar, the nav buttons do NOT have data-href attributes. For example the Previous button code is:
<li class="my-calendar-prev">
<button type="button" class="mc-navigation-button" id="mc_previous_mc_mini_widget-2">
<span class="mc-icon" aria-hidden="true"></span>
Previous
</button>
</li>I’ve checked and in both these cases, the generated code is the same when using the Twenty Twenty theme.
Hi Joe, the problem is not with my live site (which is still running My Calendar v3.6.17) but with my test site (which is used to check software updates before live release) which is running v3.7.1. The test site is deliberately not accessible on the public Internet so I’m afraid it’s not accessible to you. But I don’t believe it’s a caching issue as I can inspect the HTML generated by the plugin and it’s clearly different from that generated by v3.6.17.
I’ve just installed v3.6.2 of the plugin on my test system and it seems to have fixed all the problems I had experienced with v3.6.1 so many thanks for that.
Thanks for that, I look forward to trying the next release. With regard to the plugin update fatal error, the full info was:
Fatal error: Uncaught Error: Class “ActionScheduler_Lock” not found in /var/www/html/blog/wp-content/plugins/my-calendar/action-scheduler/classes/abstracts/ActionScheduler.php:29
Stack trace:
#0 /var/www/html/blog/wp-content/plugins/my-calendar/action-scheduler/classes/ActionScheduler_QueueRunner.php(109): ActionScheduler::lock()
#1 /var/www/html/blog/wp-includes/class-wp-hook.php(324): ActionScheduler_QueueRunner->maybe_dispatch_async_request()
#2 /var/www/html/blog/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters()
#3 /var/www/html/blog/wp-includes/plugin.php(517): WP_Hook->do_action()
#4 /var/www/html/blog/wp-includes/load.php(1304): do_action()
#5 [internal function]: shutdown_action_hook()
#6 {main} thrown in /var/www/html/blog/wp-content/plugins/my-calendar/action-scheduler/classes/abstracts/ActionScheduler.php on line 29