We would recommend you to download the theme files to local machine, then, use Notepad++ and search for keyword maps.google usually it looks like code below wp_enqueue_script('google-maps', '///maps/api/js'.Ģ. Latest themes will have an option to disable Google Maps API calls moving forward (which most themes already have right now) because the plugin has a special call with parameters for the store locator.īut certain web owners will want to use the Google maps on the Contact Us page, thus disabling it will make the contact form not working, thus we propose a solution below.ġ. The most common solution for all major theme is to modify the theme code or have an option to disable it If it’s conflicting with your theme, at the moment there’s no choice because the plugin calls google maps api with special parameters where most theme do not.ģ. If you suspect that there are other plugins using Google Maps API, you can refer to this article to disable other plugins (using Plugin Organizer – Download here) on your Super Store Finder page.Ģ. If you’re facing this issue, recommended solution as below:ġ. * Google Maps API has been changed in Feb 2016 causing a lot of javascript error if multiple map APIs being called at once Make sure you only load the Google Maps API once which from Super Store Finder plugin which has calls to specific libraries and parameters. You have included the Google Maps API multiple times on this page. When this occurs, an error will be printed to the javascript console related to the Google Maps API. If two or more plugins (or theme) load the Google Maps API, and the library is loaded twice, a javascript error will occur and the maps will stop working. However, this should only be loaded once. Themes and plugins that want to use Google Maps functionality load the Google Maps API javascript. My understanding is that Google Maps API shouldn't require jQuery to work so I'm not sure if this bit of extra info is relevant.If two or more plugins (or theme) load the Google Maps API, and the library is loaded twice, a javascript error will occur and the maps will stop working. One thing I have noticed, is that if I put a dependency in for googlemaps it DOES print the tag I'm expecting but brings up this error in the console: initMap is not a function. I've tried changing the order in which it is enqueued. I've tried clearing my browser cache and using a different browser. I'm not sure if it makes a difference but I'm working locally and running MAMP. But when attempting to enqueue/register the Google Maps API in functions.php it doesn't seem to be adding the for the Maps API under the footer as it does for other enqueued items. Moving the initMap() function to scripts.js works fine. Moving the styles to style.css works fine. The second step was moving that code out from the front-page.php and placing it in functions.php, scripts.js, and style.css. The first step in the exercise was to place Google's sample code (script & styles) directly into front-page.php and the map displayed fine. Interestingly this line does appears in the head when I enqueue googlemaps: '/js/scripts.js', array('jquery'), '1.0.0', true) Īdd_action('wp_enqueue_scripts', 'lapizzeria_styles') Īnd this is the HTML that is output below the footer (I believe I should be seeing a link to the Google API here): Wp_register_script('script', get_template_directory_uri(). Wp_register_script('fluidboxjs', get_template_directory_uri(). This is a snippet from my functions.php: wp_register_script('googlemaps', '', array(''), '', true) There are also no errors in the developer console either. When I register/enqueue the script, it doesn't appear in the HTML source code when viewing the page. I'm quite new to WordPress and I'm following a Udemy course on theme development and one part involves using the Google Maps API.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |