First of all enqueue the Google Maps API js in the right way. look for a function which is hooked on wp_enqueue_scripts
and wp_enqueue_script()
to enqueue Google Maps API
function wp_mk_scripts() {
if ( is_singular() ) {
wp_enqueue_script( 'wp-mk-maps-js', 'https://maps.googleapis.com/maps/api/js', array( 'jquery' ), null, true );
wp_enqueue_script( 'wp-mk-gmaps-function', get_stylesheet_directory_uri() . '/js/maps.js', array( 'jquery' ), null, true );
}
}
add_action( 'wp_enqueue_scripts', 'wp_mk_scripts' );
then in your theme_folder/js/maps.js paste the map code between <script></script>
tags in Style Google Maps
Now call the <div id="map"></div>
div anywhere in the template to display the map.
Related Posts:
- ReferenceError: google is not defined
- google map API zoom range
- Is there a way to display all my posts on a single Google Map?
- WordPress Google Maps
- Google Maps in WordPress
- Google Maps API problem – initMap()
- ‘SiteOrigin Google Maps’ widget conflicting with ‘ProtheusThemes’
- Anyway to have google maps display multiple AND unique locations per individual posts/pages?
- Google Map is not working on the second tab of Tab Plugins
- How to pinpoint posts location with Google map v3?
- Geo Mashup Maps show only specified categories
- Maps search box autocomplete with callback JS function?
- create dynamic google map with iframe api
- Google map API Key restrictions does not recognize website IP
- How to get input value after google maps autocomplete?
- Google Maps API in wordpress
- Add different custom markers for different post types in Google maps API
- ACF Google Maps – Multiple Pins
- Using Custom Field in Google Map Embed Code Works in One Theme, Not Another
- Google Map Integration
- Mixed Content: The page at ‘https://www.taylortireauto.com/?s=contacts’ was loaded over HTTPS [closed]
- Google map iframe into wordpress theme [closed]
- How to handle multiple distance matrix api request in loop to reduce load and request time?
- google map Info window [closed]
- Google Map not displayed [closed]
- WordPress – Generate Longitude Latitude Map into Page
- function updateMap for Google Maps API
- Type error: cannot convert the series to
- JSON to pandas DataFrame
- How can I change the color of a Google Maps marker?
- Using google API to tell how busy a place is
- Google Maps API DeletedApiProjectMapError
- ApiNotActivatedMapError for simple html page using google-places-api
- How to query posts based on lat-lng coordinate as post meta?
- Remove extra Google Maps script
- Google Maps not displaying in wordpress using Google Maps Javascript API
- Custom Post Type with Input fields to seperate table on database.
- Integrating Google Maps with custom marker and hover?
- Geocoding an Exploded Custom Field Array
- WordPress Google Maps in Custom Theme
- Google Maps and Yandex Maps doesn’t work correctly
- Show posts on a Google Map
- Travel Blog Plugins
- How can I automatically attach posts to a map?
- AJAX in WordPress, sending coords data to MySQL and show after into map
- Problem Building a Simple Google Maps Plugin
- Google Map iframe in a tab issue
- Putting PHP variables into javascript [duplicate]
- Google maps causing mixed content in header
- I need to get an array from the wordpress database
- How to implement a Google map store locator
- Google Map Shortcode for Custom Taxonomy/Post Types
- Location-Based Pages displaying results near customer
- Integrating PHP into Javascript to display map markers with Google API – problem with wp_localize
- Refresh Markercluster after ajax call
- PHP array to JS array to use in google map
- GeoMashup plugin: how to customize cluster markers / icons? [closed]
- How to add multiple markers on the google map, at a certain meta_key and meta_value
- Extracting Address from Custom Post via Javascript for Google Maps API
- Plot location on Google map using full address specified in custom field
- This page can’t load Google Maps correctly [closed]
- passing markup thought a shortcode attribute
- Google map that plot’s several markers – each one with custom data
- Where is my google maps on my page? [closed]
- ACF Maps admin error: “For development purposes only” even after supplying api key
- Anybody knows if i could upload a leaflet or openlayers3 map to wordpress webpage?
- Where to paste Google Map Snippet / JavaScript / CSS for WordPress integration
- Using custom post types WordPress network
- Using the loop to set locations for all posts on a single google map
- How to automatically create an index of child sites at the root url for a multisite installation?
- Google Maps with categories
- MapPress Easy Google Map in Jquery Tabs Problem
- Form behaving differently on small screens vs desktop screen
- Adding geographical information on a registration page
- Insert Google Maps HTML in WordPress
- Filtering markers on google map by WordPress category[SOLVED]
- create a shortcode for embedding google map in a page
- mutiple shortcode instance on the same page
- Where is fusion-gmap-container?
- Advanced Custom Fields – Google Map Won’t Render Unless Variable Dumped
- Display posts on a map
- Dealing with multiple Google maps API calls
- Foreach loop inside foreach loop?
- Querying latitude and longitude into google maps correctly
- Add routes between multiple ACF google maps markers [closed]
- I want to split this into two functions
- Why won’t the Comprehensive Google Map Plugin load?
- Plugin – including external javascript calling google maps
- Geolocate Custom Post Type on Save
- How to grab data (titles, thumbnails and custom fields) from multiple posts to populate a new array efficiently?
- How to extract specific image meta for all images?
- Cannot Hide Google Map if custom field is blank
- Adding a google map to a metabox, map has inline style height=0
- Search Results with googlemaps
- In WP, Google map error initMap is not a function [closed]
- Custom Backend data for map to JSON file?
- Google Map JavaScript error after migrating
- Why is this script not working?
- I want to lists posts in wordpress to nearest location entered by the user
- Making the Google Maps API non readable