calendar loading
-
Hello,
I have a problem with the calendar. It is not visible anymore for visitors and it says “Calendar is loading…” but it doesn’t show.
I tried to disable all plugins but it doesn’t work, please help me.How can I fix it?
Thank you
The page I need help with: [log in to see the link]
-
Hello.
Do you have the same issue at the Booking > Add booking page in Admin panel ?
If not, then probably, its because of conflict with some other plugin or actual theme.
Please try to deactivate all your plugins and active the default WordPress theme. And then retest it again.
Thank you.Hello.
1) You are having at your webpage this JavaScript errors:
Uncaught ReferenceError: jQuery is not defined <anonymous> https://www.comitatotreottobre.it/prenota-un-incontro/:108 prenota-un-incontro:108:13Because of JavaScript at the page the calendar is not showing, and you see message “Calendar is loading”…
2) The reason of that errors, because all your JavaScript files have defer attribute. Please check more here https://javascript.info/script-async-defer
Example:
<script type='text/javascript' defer='defer' src='https://www.comitatotreottobre.it/wp-includes/js/jquery/jquery.min.js?ver=3.6.0' id='jquery-core-js'></script> <script type='text/javascript' defer='defer' src='https://www.comitatotreottobre.it/wp-includes/js/jquery/jquery-migrate.min.js?ver=3.3.2' id='jquery-migrate-js'></script>It’s means that such JavaScript files will be loaded after page loaded. And inside of the content of the page exist some JavaScript that calling jQuery (which is not defined at that time, because JavaScript files was not loaded) that generate these JavaScript errors.
3) By default WordPress does not modify the scripts with this attribute. It’s some other plugin or theme add such attribute.
How to resolve this issue?
You can check in other your activated plugins or actual theme settings, some option that can be disabled of adding such defer attribute. Sometimes it’s can be called like optimize JavaScript files, etc…Otherwise you can make this fix in the Booking Calendar plugin (which will be exist in future updates of Booking Calendar).
Please open this file ../wp-content/plugins/booking/core/wpbc-js.php
( you can check how to edit files in WordPress menu in this article https://wpbookingcalendar.com/faq/how-edit-file-in-wp-menu/ )
then find this code:
// Load JavaScript files in all other versions do_action( 'wpbc_enqueue_js_files', $where_to_load ); }and replace it to this code:
// Load JavaScript files in all other versions do_action( 'wpbc_enqueue_js_files', $where_to_load ); /* * Remove <code>async</code> and <code>defer</code> ( check more here https://javascript.info/script-async-defer ) * for scripts registered or enqueued, that required for correct working of plugin, like * jquery and all Booking Calendar scripts * because inside content of the page can be something like jQuery(document).ready( function(){ ...} which will * generate Uncaught ReferenceError: jQuery is not defined */ add_filter( 'script_loader_tag', array( $this, 'filter_script_loader_tag' ), 9000000000 , 3 ); } /** * Remove <code>async</code> and <code>defer</code> ( check more here https://javascript.info/script-async-defer ) * for scripts registered or enqueued, that required for correct working of plugin, like * jquery and all Booking Calendar scripts * * @param string $tag The script tag. * @param string $handle The script handle. * * @return string Script HTML string. * */ public function filter_script_loader_tag( $tag, $handle, $src ) { $script_handles_prevent_defer = array( 'jquery-core' // exact value , 'jquery-migrate' //, 'wpbc-' //starting from 'wpbc-' it's not the exact value //, 'wpdevelop-' ); // Remove defer and async attribute from the src. if ( ( 'jquery-core' === $handle ) || ( 'jquery-migrate' === $handle ) || ( false !== strpos( $handle, 'wpbc-' ) ) // Booking Calendar scripts || ( false !== strpos( $handle, 'wpdevelop-' ) ) || ( false !== strpos( $handle, 'wpbm-' ) ) ) { foreach ( array( 'async', 'defer' ) as $attr ) { if ( preg_match( ":\s$attr(=|>|\s):", $tag ) ) { $tag = str_replace($attr, '', $tag); $tag = str_replace('=""', '', $tag); $tag = str_replace("=''", '', $tag); /* * Test here https://regex101.com/ * * Expression: \s+defer(\s*=\s*["']defer["'])?\s? * Test string: <script type='text/javascript' defer = 'defer' defer="defer" src='http://beta/wp-content/plugins/booking-manager/js/wpbm_vars.js?ver=1.1' id='wpbm-global-vars-js'></script> * */ $pattern = ":\s+{$attr}(\s*=\s*[\"']{$attr}[\"'])?\s?:mi"; $replacement = ' '; $tag = preg_replace($pattern, $replacement, $tag); } } } return $tag; }Kind Regards.
Thank you so much
The topic ‘calendar loading’ is closed to new replies.