Home › Forums › Calendar Products › Events Calendar PRO › Events Calendar causing error with CM Ad Changer plugin
- This topic has 8 replies, 2 voices, and was last updated 11 years, 2 months ago by
Geoff.
-
AuthorPosts
-
January 25, 2015 at 2:12 pm #937385
conexionagenciadigital
ParticipantThe Events Calendar plugin is causing some kind of JavaScript error with the CM Ad Changer PRO plugin (https://wordpress.org/plugins/cm-ad-changer/):
> When the events are loading, the CM Ad changer plugin shows ads on the right sidebar
> As soon as the events finish loading, the ads disappearCheck it out here http://momxpress.com/eventos/
January 26, 2015 at 7:53 am #937611Geoff
MemberHi there, Pablo! Thanks for getting in touch and sorry you’re hitting a conflict here.
I see the following error pop on in the console when I view your site:
You have included the Google Maps API multiple times on this page. This may cause unexpected errors.That is likely because either your theme or one of the other installed plugins is injecting a Google Maps script in addition to the one that The Events Calendar includes. You will want to find out what is injecting that other script, then dequeue it from Events pages so the conflict goes away.
You can test for what is injecting the additional instance of Google Maps by following the steps listed here in our Testing for Conflicts Guide.
Cheers!
GeoffFebruary 3, 2015 at 10:15 am #939776Geoff
MemberHey there, Pablo! Just checking in to see if there’s been any update or if you still need assistance on this one–please let me know. 🙂
Cheers!
GeoffFebruary 5, 2015 at 7:36 am #940233conexionagenciadigital
ParticipantHi there Geoff, I’ll be checking this today and will let you know!
Thanks,
February 5, 2015 at 9:00 am #940265Geoff
MemberThanks, keep me posted!
February 5, 2015 at 9:48 am #940287conexionagenciadigital
ParticipantHello Geoff,
As you pointed out, the problem is that the Google Maps API is being called twice. Once by the CM ad changer plugin and the other by The Events Calendar. Can I dequeue the one from Events Calendar? I found the following code in module-map.php
class TB_Map_Module extends Themify_Builder_Module { function __construct() { parent::__construct(array( 'name' => __('Map', 'themify'), 'slug' => 'map' )); add_action( 'wp_enqueue_scripts', array( $this, 'load_map_script' ) ); } function load_map_script() { //Register map scripts wp_register_script( 'themify-builder-map-script', themify_https_esc( 'http://maps.google.com/maps/api/js' ) . '?sensor=false', array(), false, true ); } }How can I dequeue the script?
February 5, 2015 at 10:09 am #940293conexionagenciadigital
ParticipantHi again Geoff,
Nevermind my last post, that file belongs to a plugin we are not longer using. I found the following code on my theme’s functions.php file:
$http = 'http'; if (is_ssl()) $http = 'https'; wp_register_script('et-googlemap-api', $http . '://maps.googleapis.com/maps/api/js?sensor=true', '3.0', true);This is inside a function being called with the “init” action. How can I dequeue the script just for the Events page?
Thanks,
February 5, 2015 at 10:20 am #940298Geoff
MemberNice work! Way to nail it down. 🙂
Here is a list of conditional statement examples you can use to target that script from not firing on specific calendar views.
Or perhaps, you can try wrapping that in a condition statement that excludes the script if the TribeEvents class exists:
if(class_exists('TribeEvents')) { ... }Cheers!
GeoffFebruary 19, 2015 at 5:52 pm #943835Geoff
MemberHi there, Pablo! This thread’s been quiet for a couple of weeks, so I’m going to go ahead and close it. Please feel free to start a new thread if any other questions pop up and we’d be happy to help. 🙂
Cheers!
Geoff -
AuthorPosts
- The topic ‘Events Calendar causing error with CM Ad Changer plugin’ is closed to new replies.
