This article will provide you with a WordPress function that'll permit you to post Google Maps inside of your WordPress post or page using shortcode. It's ported over from the retired Internoetics, but it still works (despite being a little dated). You're required to register for an API key, and you should register your embed page and/or server IP to ensure your key isn't abused if publicly displayed.
Using the shortcode of
[googlemap src="8 cavendish st concord west nsw 2138"] we'll render the following map (the address is one formerly owned by family).
Available attributes are detailed below. The shortcode should be modified to your preferred defaults so you'll only ever need to specify the
Copy and paste the WordPress function into your theme's
functions.php file or, if you sensibly have one installed, your custom functions plugin.
Once you've copied the code as required, the only attributes that are really required are
height are set, it'll only be
src (address) that's ever required in your shortcode. Other options are not required.
Available attributes are as follows:
widthof the Google Map (iframe). It should normally be set to a little less than the width of your post container. By default, it will center.
heightof the iframe.
maptypecan be either
roadmap(the default) or
satellite, and defines the type of map tiles to load.
zoomwill set the initial zoom level of the map. Accepted values range from 0 (the whole world) to 21 (individual buildings). The upper limit can vary depending on the map data available at the selected location.
centerdefines the center of the map view. It accepts a comma-separated latitude and longitude value (such as 37.4218,-122.0840).
languagedefines the language to use for UI elements and for the display of labels on map tiles. Note that this parameter is only supported for some country tiles; if the specific language requested is not supported for the tile set, then the default language for that tileset will be used. By default, visitors will see a map in their own language.
regiondefines the appropriate borders and labels to display, based on geo-political sensitivities. Accepts a region code specified as a two-character ccTLD (top-level domain) value.
Using some of the available attributes, here's another look at the old address (the old house is replaced by dodgy townhouses). Shortcode used is as follows:
[googlemap src="8 moala st concord west nsw 2138" zoom="19" maptype="satellite"].
We'll update the code soon.