Events Calendar causing error with CM Ad Changer plugin

Home Forums Calendar Products Events Calendar PRO Events Calendar causing error with CM Ad Changer plugin

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #937385

    The 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 disappear

    Check it out here http://momxpress.com/eventos/

    #937611
    Geoff
    Member

    Hi 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!
    Geoff

    #939776
    Geoff
    Member

    Hey 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!
    Geoff

    #940233

    Hi there Geoff, I’ll be checking this today and will let you know!

    Thanks,

    #940265
    Geoff
    Member

    Thanks, keep me posted!

    #940287

    Hello 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?

    #940293

    Hi 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,

    #940298
    Geoff
    Member

    Nice 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!
    Geoff

    #943835
    Geoff
    Member

    Hi 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

Viewing 9 posts - 1 through 9 (of 9 total)
  • The topic ‘Events Calendar causing error with CM Ad Changer plugin’ is closed to new replies.