Google Maps JS Conflict

Home Forums Calendar Products Events Calendar PRO Google Maps JS Conflict

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #660571
    jinsley8
    Participant

    Hi,

    I have a javascript conflict with my theme and my calendar both pulling in the same google maps scripts. Which file can I edit to stop the plugin from calling the map script?

    “You have included the Google Maps API multiple times on this page. This may cause unexpected errors.”

    #668255
    Barry
    Member

    Hi – I’m sorry you’re experiencing difficulties.

    If this is occurring on single event/venue pages (in addition to map view) then I think it’s going to be easiest to approach your theme vendor and ask them the same question – then remove their inclusion of the Google Maps API.

    The reason I’m suggesting this is that – in our current releases, though a change is in the works – the Google Maps API cannot simply be dequeued the way many other scripts can, nor can the template that loads Google Maps be easily overridden as most other templates can.

    With that in mind, if your theme’s author can give you a path forward that’s likely to be the cleanest and safest route here.

    Does that help?

    #668350
    jinsley8
    Participant

    Yes, this is happening on the single event pages. This solution isn’t an option though because my theme is a directory theme that makes heavy use of Google Maps and Google Street View.

    Before switching to ECP I was using the EventOn plugin which had an admin toggle to turn the Google Maps API on/off. The pages still work fine as far as I can tell but this error still shows in the console. I’ll live with it for now.

    #669162
    Barry
    Member

    OK, I’m sorry we can’t do too much else at present. We are making some changes though that will make it a lot easier to dequeue our own Google Maps scripts.

    One thing that does come to mind, though, is that if you can obtain a snippet from the theme authors to dequeue their Google Maps API script then we can probably give you some tweaks that will apply it only to single event and venue pages – which would avoid impact on any other sections of your site 🙂

    This also makes sense from the point of view that The Events Calendar itself does not enqueue Google Maps on anything but its own pages so, in a sense, it is really your theme which is encroaching on The Events Calendar’s space rather than the other way round.

    #672638
    michael albee
    Participant

    I added this to a custom page-events.php

    <?php wp_deregister_script( ‘google_map_api’, ‘https://maps.googleapis.com/maps/api/js?sensor=false&#8217; ); ?>

    deregistering the google maps api from my themes functions file. Which seemed to do the trick with the multiple loads

    But now, I have this issue: Uncaught TypeError: Cannot read property ‘offsetWidth’ of null on the venue pages and the map doesn’t load into the frame. UGH!

    #723407
    Barry
    Member

    Hi! It’s been a while so I’m going to go ahead and close this thread. If we can help with anything else, though, please don’t hesitate to create new threads as needed. Thanks!

    (@michael – apologies for missing your post – unfortunately we are not notified when someone other than the original poster updates the thread… if you still need help definitely do open a fresh thread and someone will be along to help shortly. Thanks!)

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Google Maps JS Conflict’ is closed to new replies.