![]() ![]() The rest of the php code is not a problem, but that line (even commented) breaks everything. Ive created an option tab with Advanced Custom fields where you can paste your Google Maps API key, so I dont have to put the API key in the code over and over again when starting a new project. ![]() This seems to do the trick with Divi builder hanging. And take your Google Map API Key out As this is already included in the WPgoogle maps Advanced Tab settings. (window, "load", initMap) Īfter a some time of trying things I noticed that the problem seems to be when I add this line //var json_data = "" Ive added an option into Divi Booster to prevent excerpts from loading the Google Maps scripts unnecessarily. If anyone is using the divi theme or builder Turn of the Enqueue Google Maps Script in the div options page. Map = new (document.getElementById('map'), , The Overflow Blog How do we get a tech team to make a big technical change A conversation with the folks. But as soon as I change the extension to php, it breaks. wp-enqueue-script google-maps or ask your own question. I usually add true to the google-map script as well. Also thanks to the suggestion you posted last week for someone else regarding Divi and turning off Enqueue Google Maps Script is settings to get the Map Block working. You spelled enqueue wrong on the add action line for your function name. I spent too much time experimenting with this. functions.php This file contains bidirectional Unicode text that may be interpreted or compiled. Can I make a suggestion that the display of this message be changed as it is disconcerting and suggests that the maps will not work. However, I want my code to run the query that produces the GeoJSON data, and I know how to do that in php. Enqueue Google Maps API and our script to initialise the map Raw. I'm using Xampp to load Apache and view files on my browser. html the map shows up just fine, and it shows the data I want to see (a Linestring). Disable this option to remove the Google Maps API script from your Divi Builder Pages. Now this works fine on the checkout page, however on other pages i’m getting errors as the script is not included there.I've been trying to load some GeoJSON data into a map, using Google Maps API. Therefore I added in a check, to see if it is the checkout page ‘setup.php’ Since i only use the Google Maps script on the checkout page, I only want to enqueue it there. This may cause unexpected errors.,Im developing a plugin that use a Google Maps API. Then in webpack externals i have: google: 'google' In which i do import google from 'google' and the code that interacts with the api of course. I also have a routed JS file on the checkout page. You can change true to false if you want it in the header. then we enqueue the script to be added in the footer. We then check if googlemapsapi function exists in case we forgot to include it. Wp_enqueue_script('google-places', ''.get_option( 'bull-api-keys-maps-key'), false, null ,false) It simply checks if the current page has a locations field which would require a google map. I’m using the Google Maps API on the WooCommerce checkout page to autocomplete the address fields.Ĭurrently I enqueue the Google Maps script in ‘setup.php’ on all pages. Sorry if I was unclear, i’ll try to explain it with errors. I have an addition: 'script' should be dependent on 'google-maps' so there is no reason to enqueue 'google-maps' in the header. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |