Home › Forums › Calendar Products › Events Calendar PRO › Dequeue Events Calendar Google Maps API
- This topic has 5 replies, 4 voices, and was last updated 9 years, 4 months ago by
shokideagroup.
-
AuthorPosts
-
December 8, 2016 at 6:26 am #1203088
shokideagroup
ParticipantHey,
I am overriding the single-event template and using my own Google maps API within the template. I would like to dequeue the Events Calendar’s Google maps API, so that I do not have two on the page.
I saw this post (https://theeventscalendar.com/support/forums/topic/google-maps-in-footer-on-events-page-duplicate-gmaps-script-acf-problem/) and tried to dequeue the following scripts inside my functions file, but it had no effect.
function remove_events_map_apis() { wp_dequeue_script( 'tribe_events_google_maps_api' ); wp_dequeue_script( 'tribe_events_embedded_map' ); wp_dequeue_script( 'tribe-gmaps' ); wp_dequeue_script( 'tribe-events-pro-geoloc' ); } add_action( 'wp_print_scripts', 'remove_events_map_apis' );Thanks in advance for the help!
December 8, 2016 at 7:16 pm #1203636Cliff
MemberHi. Thanks for your detailed question.
What if you add a higher priority, like 100, to your add_action line, like in the code snippet in that other thread?
And may I ask why dequeuing ours and using your own (or the one from another plugin or your theme)?
Thanks.
December 9, 2016 at 7:12 am #1203807shokideagroup
ParticipantHey Cliff,
Once you said something about priority it got me thinking that what I wanted to dequeue was in the footer. So I was able get it to work by replacing “wp_print_scripts” with “wp_footer”. I also only needed to dequeue two scripts, the following code is what worked for me in case anyone else needs to do the same thing.
function tribe_events_map_apis() { wp_dequeue_script( 'tribe_events_google_maps_api' ); wp_dequeue_script( 'tribe_events_embedded_map' ); } add_action( 'wp_footer', 'tribe_events_map_apis' );I needed to dequeue your Google Maps API and use my own, because I needed to add “&callback=initMap” to the end of src.
Thanks for your help!
December 9, 2016 at 2:53 pm #1204218Cliff
MemberThanks for sharing.
What about just filtering the URL that gets used by our plugin. Maybe something along the lines of https://gist.github.com/cliffordp/9d6c25feb389f98e8ae09a41273a3488 or even using add_query_arg()
December 31, 2016 at 8:35 am #1212035Support Droid
KeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘Dequeue Events Calendar Google Maps API’ is closed to new replies.
