Hi Stephanie,
This is a new alert we’ve added specifically for use cases like yours. The simple answer to your question is “No”, the Javascript needs to only be applied once, so if you dequeue the other script, both will be able to use the script in our plugin just fine.
But, there are cases where that may be problematic. Give me a little bit and I’ll test your use-case and provide a snippet that should help you get around this issue.
Please tell me specifically which Events plugin you are using which uses the Google Maps Javascript in it so I can test.
Thanks!
I sent you a private message on our support forum with an email address to send that plugin to for testing. Thanks!
Sure! I’ve sent over an email with the plugin attached.
Thanks!
@amoonalu
In your case this is the function you should place in your themes functions.php:
function dequeue_eventon_gmaps_scripts() {
wp_dequeue_script( 'evcal_gmaps' );
wp_deregister_script( 'evcal_gmaps' );
update_option( 'gmb_google_maps_conflict', false );
}
add_action( 'wp_print_scripts', 'dequeue_eventon_gmaps_scripts', 100 );
Let me know how that goes.
I think I must have pasted it wrong… again, I’m not very good with code. Is there a certain place in the theme functions.php I’m meant to put it? I tried pasting it at the bottom and nothing happened, so I’m sure I must have done it wrong.
No, pasting it exactly as you see it there should be fine. One thing I forgot to mention is after you’ve pasted it in, go to the FRONTEND of your site, specifically to a page where the Events are, and press CTRL and F5. Then go to the BACKEND again and go to the Dashboard or refresh that page. That should help.
If you still see it, try these things:
1) In the last line, try changing the 100 to 9
2) Make sure that there is not a ?> right BEFORE the whole thing. If there is, move it to the end.
3) Check if perhaps you have even another plugin that uses the Google Maps API by disabling ALL plugins except Google Maps Builder and EventOn. If the notification goes away with only those two enabled, then re-enable each one, one by one and refresh the front-end each time and check for when the notification comes back. Then let me know which plugin uses the API and I’ll give you another updated code.
Let me know.
Okay, the warning has gone away, but now none of my maps are visible. I tried changing the 100 to a 9, I tried the CTRL + F5 instruction, and I also disabled all my plugins except Google Maps Builder and EventOn without any change.
I don’t know if this would affect it but I’m using a multiple themes plugin: https://wordpress.org/plugins/jonradio-multiple-themes/. I added the code to both of the themefunction.php’s, but maybe the problem is there? Though I disabled that as well…
I need to take a look under the hood I think. Can you email me at support at wordimpress.com?
I’m having the same issue with another plugin. It’s Event Organiser. Tried using this in my functions.php, but no luck…
function dequeue_eventorganiser_gmaps_scripts() {
wp_dequeue_script( ‘eventorganiser_gmaps’ );
wp_deregister_script( ‘eventorganiser_gmaps’ );
update_option( ‘gmb_google_maps_conflict’, false );
}
add_action( ‘wp_print_scripts’, ‘dequeue_eventorganiser_gmaps_scripts’, 100 );
Thanks!
Hi @catsigater
The code you’ll want to resolve the conflict for the Event Organizer is this:
function dequeue_eventorganiser_gmaps_scripts() {
wp_dequeue_script( 'eo_GoogleMap' );
wp_deregister_script( 'eo_GoogleMap' );
update_option( 'gmb_google_maps_conflict', false );
}
add_action( 'wp_print_scripts', 'dequeue_eventorganiser_gmaps_scripts', 9 );
Let me know how that goes. Thanks!
Hi Matt.
Were you able to resolve amoonalu’s issue? Mine’s the same. I installed the code, and the error message is gone, but the map space is now blank. I’ll be happy to give you whatever access you need.
Thanks so much for your help.
Andy
Hi @catsigater
We resolved the main issue, yes. Add this code after what was provided previously:
function gmaps_api_js() {
wp_enqueue_script( 'gmaps-master-js', 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false&libraries=places', array(), 'null', true );
}
add_action( 'wp_enqueue_scripts', 'gmaps_api_js' );
That did it. I copied the code directly from my email which was rendering the apostrophes as “'”. But once I replaced them back, works like a charm.
Thanks! This is site’s getting ready to go live, so I appreciate the quick response.
Thanks for jumping in and solving Matt. @catsigater – if you’re happy with the plugin and support please rate it 5-stars to help us out! Thanks! http://wordpress.org/support/view/plugin-reviews/google-maps-builder