Undefined Variable $calendar in countdown.php
-
Investigating a few issues with my site, and noticed this in my error log. Just reporting it to you.
[05-Sep-2024 17:17:09 UTC] PHP Warning: ?Undefined variable $calendar in /wp-content/themes/theme/sportspress/countdown.php on line 45
-
Hi there @ibeats ,
It seems like theme related issue. Did you try to temporarily switch to a default theme like “Rookie” or “Twentytwenty”?
Thanks, Savvas
Sorry, I sent you the wrong error code. I had tried what you said… this is the error when I just have vanilla SportsPress on twentytwenty.
PHP Warning: ?Undefined variable $calendar in /wp-content/plugins/sportspress/templates/countdown.php on line 45
Hi there @ibeats ,
How are you showing the countdown? With a widget? Can you share the settings of it in a screenshot?
Thanks,
SavvasHi Savvas, it’s a shortcode within my page template;
<!-- wp:shortcode -->
[countdown team="171" show_venue="0" show_league="0" align="none"]
<!-- /wp:shortcode --></div>full template.
<!-- wp:template-part {"slug":"header","theme":"site-child","tagName":"header"} /-->
<!-- wp:group {"tagName":"main","style":{"spacing":{"margin":{"top":"0px","bottom":"0px"}}},"layout":{"type":"default"}} -->
<main class="wp-block-group" style="margin-top:0px;margin-bottom:0px"><!-- wp:group {"style":{"spacing":{"padding":{"top":"25px","right":"25px","bottom":"25px","left":"25px"}}},"backgroundColor":"custom-footer-blue","layout":{"type":"constrained"}} -->
<div class="wp-block-group has-custom-footer-blue-background-color has-background" style="padding-top:25px;padding-right:25px;padding-bottom:25px;padding-left:25px"><!-- wp:group {"align":"wide","layout":{"type":"default"}} -->
<div class="wp-block-group alignwide"><!-- wp:post-title {"textColor":"white","fontSize":"extra-large"} /--></div>
<!-- /wp:group --></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"margin":{"top":"0px","bottom":"0px"},"padding":{"top":"60px","right":"20px","bottom":"40px","left":"20px"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group" style="margin-top:0px;margin-bottom:0px;padding-top:60px;padding-right:20px;padding-bottom:40px;padding-left:20px"><!-- wp:group {"align":"wide","layout":{"type":"default"}} -->
<div class="wp-block-group alignwide"><!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"70%"} -->
<div class="wp-block-column" style="flex-basis:70%"><!-- wp:post-content /-->
<!-- wp:group {"layout":{"type":"flex","flexWrap":"wrap","justifyContent":"space-between"}} -->
<div class="wp-block-group"><!-- wp:post-navigation-link {"type":"previous","showTitle":true,"fontSize":"medium"} /-->
<!-- wp:post-navigation-link {"showTitle":true,"fontSize":"medium"} /--></div>
<!-- /wp:group -->
<!-- wp:comments -->
<div class="wp-block-comments"><!-- wp:comments-title /-->
<!-- wp:comment-template -->
<!-- wp:columns -->
<div class="wp-block-columns"><!-- wp:column {"width":"40px"} -->
<div class="wp-block-column" style="flex-basis:40px"><!-- wp:avatar {"size":40,"style":{"border":{"radius":"20px"}}} /--></div>
<!-- /wp:column -->
<!-- wp:column -->
<div class="wp-block-column"><!-- wp:comment-author-name {"fontSize":"small"} /-->
<!-- wp:group {"style":{"spacing":{"margin":{"top":"0px","bottom":"0px"}}},"layout":{"type":"flex"}} -->
<div class="wp-block-group" style="margin-top:0px;margin-bottom:0px"><!-- wp:comment-date {"fontSize":"small"} /-->
<!-- wp:comment-edit-link {"fontSize":"small"} /--></div>
<!-- /wp:group -->
<!-- wp:comment-content /-->
<!-- wp:comment-reply-link {"fontSize":"small"} /--></div>
<!-- /wp:column --></div>
<!-- /wp:columns -->
<!-- /wp:comment-template -->
<!-- wp:comments-pagination -->
<!-- wp:comments-pagination-previous /-->
<!-- wp:comments-pagination-numbers /-->
<!-- wp:comments-pagination-next /-->
<!-- /wp:comments-pagination -->
<!-- wp:post-comments-form /--></div>
<!-- /wp:comments --></div>
<!-- /wp:column -->
<!-- wp:column {"width":"30%"} -->
<div class="wp-block-column" style="flex-basis:30%"><!-- wp:group {"tagName":"main","style":{"spacing":{"margin":{"top":"0px","bottom":"0px"}}},"layout":{"type":"default"}} -->
<main class="wp-block-group" style="margin-top:0px;margin-bottom:0px"><!-- wp:group {"align":"wide","layout":{"type":"default"}} -->
<div class="wp-block-group alignwide"><!-- wp:group {"style":{"spacing":{"padding":{"top":"20px","right":"20px","bottom":"20px","left":"20px"}}},"backgroundColor":"section-bg","layout":{"type":"constrained"}} -->
<div class="wp-block-group has-section-bg-background-color has-background" style="padding-top:20px;padding-right:20px;padding-bottom:20px;padding-left:20px"><!-- wp:group {"style":{"border":{"bottom":{"color":"var:preset|color|primary","width":"2px"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group" style="border-bottom-color:var(--wp--preset--color--primary);border-bottom-width:2px"><!-- wp:heading {"level":3,"style":{"typography":{"letterSpacing":"1px"},"spacing":{"margin":{"bottom":"10px"}}}} -->
<h3 class="wp-block-heading" style="margin-bottom:10px;letter-spacing:1px">Sponsors</h3>
<!-- /wp:heading --></div>
<!-- /wp:group -->
<!-- wp:image {"lightbox":{"enabled":false},"id":622,"sizeSlug":"full","linkDestination":"custom"} -->
<figure class="wp-block-image size-full"><a ><img src="https://site.co.uk/wp-content/uploads/2024/08/U7-2425-SponsorLogo-site-1.png" alt="https://siteltd.co.uk" class="wp-image-622"/></a></figure>
<!-- /wp:image --></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"padding":{"top":"20px","right":"20px","bottom":"20px","left":"20px"}}},"backgroundColor":"section-bg","layout":{"type":"constrained"}} -->
<div class="wp-block-group has-section-bg-background-color has-background" style="padding-top:20px;padding-right:20px;padding-bottom:20px;padding-left:20px"><!-- wp:group {"style":{"border":{"bottom":{"color":"var:preset|color|primary","width":"2px"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group" style="border-bottom-color:var(--wp--preset--color--primary);border-bottom-width:2px"><!-- wp:heading {"level":3,"style":{"typography":{"letterSpacing":"1px"},"spacing":{"margin":{"bottom":"10px"}}}} -->
<h3 class="wp-block-heading" style="margin-bottom:10px;letter-spacing:1px">Next Game</h3>
<!-- /wp:heading --></div>
<!-- /wp:group -->
<!-- wp:shortcode -->
[countdown team="171" show_venue="0" show_league="0" align="none"]
<!-- /wp:shortcode --></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"padding":{"top":"20px","right":"20px","bottom":"20px","left":"20px"}}},"backgroundColor":"section-bg","layout":{"type":"constrained"}} -->
<div class="wp-block-group has-section-bg-background-color has-background" style="padding-top:20px;padding-right:20px;padding-bottom:20px;padding-left:20px"><!-- wp:group {"style":{"border":{"bottom":{"color":"var:preset|color|primary","width":"2px"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group" style="border-bottom-color:var(--wp--preset--color--primary);border-bottom-width:2px"><!-- wp:heading {"level":3,"style":{"typography":{"letterSpacing":"1px"},"spacing":{"margin":{"bottom":"10px"}}}} -->
<h3 class="wp-block-heading" style="margin-bottom:10px;letter-spacing:1px">Latest Result</h3>
<!-- /wp:heading --></div>
<!-- /wp:group -->
<!-- wp:shortcode -->
[event_blocks class="sp-table-caption" team="171" league="0" season="0" venue="0" status="publish" format="default" date="0" date_from="" date_to="1" date_past="14" date_future="1" date_relative="0" day="" number="1" orderby="date" order="DESC" show_all_events_link="0" align="none"]
<!-- /wp:shortcode --></div>
<!-- /wp:group -->
<!-- wp:group {"style":{"spacing":{"padding":{"top":"20px","right":"20px","bottom":"20px","left":"20px"}}},"backgroundColor":"section-bg","layout":{"type":"constrained"}} -->
<div class="wp-block-group has-section-bg-background-color has-background" style="padding-top:20px;padding-right:20px;padding-bottom:20px;padding-left:20px"><!-- wp:group {"style":{"border":{"bottom":{"color":"var:preset|color|primary","width":"2px"}}},"layout":{"type":"constrained"}} -->
<div class="wp-block-group" style="border-bottom-color:var(--wp--preset--color--primary);border-bottom-width:2px"><!-- wp:heading {"level":3,"style":{"typography":{"letterSpacing":"1px"},"spacing":{"margin":{"bottom":"10px"}}}} -->
<h3 class="wp-block-heading" style="margin-bottom:10px;letter-spacing:1px">Calendar</h3>
<!-- /wp:heading --></div>
<!-- /wp:group -->
<!-- wp:shortcode -->
[event_calendar id="429" team="171" show_all_events_link="1"]
<!-- /wp:shortcode --></div>
<!-- /wp:group --></div>
<!-- /wp:group --></main>
<!-- /wp:group --></div>
<!-- /wp:column --></div>
<!-- /wp:columns --></div>
<!-- /wp:group --></div>
<!-- /wp:group --></main>
<!-- /wp:group -->
<!-- wp:template-part {"slug":"footer","theme":"site-child","tagName":"footer"} /-->Hi there @ibeats ,
It seems like there is a bug. Can you apply the following patch and confirm that it solves it?
https://github.com/ThemeBoy/SportsPress/pull/467/commits/33a8135041ebd64f7bef20d3abc93d6bbff8405d
Thanks,
SavvasYup, that looks like it’s fixed it – great work. Thank you!
- You must be logged in to reply to this topic.