Simple Shortcode for GoogleMaps

外掛說明

Simple to use, yet powerful, Google Maps plugin! Reviews say this is “Best Google Map Shortcode plugin”.

Put a Google map on your WordPress posts and pages simply and easily with a shortcode. Straight forward and easy to use! Ideal for contact page maps, maps showing delivery areas and many other uses!

This plugin will enable a simple shortcode that you can use for embedding Google Maps in any WordPress post or page. The shortcode uses the WordPress HTTPS API and the Transients API for delivering cached Google maps with little to no impact on your site’s performance.

Maps are displayed with the [pw_map] shortcode:

[pw_map address="New York City" key="YOUR API KEY"]

Google now requires that new accounts use an API key. You can register a free API key here.

You can have multiple map pins, simply add multiple addresses separated by semi-colon ;

[pw_map address="Statue of Liberty National Monument NYC;Empire State Building, New York, NY, USA" key="YOUR API KEY"]

安裝方式

  1. Activate the plugin.
  2. Obtain an API key here.
  3. Added [pw_map address=”your address here” key=”YOUR API KEY”] to any post or page.

常見問題集

Can I change the width or height of the map?

Yes, simply supply a width and height parameter:

[pw_map address="New York City" width="400px" height="200px" key="YOUR API KEY"]

You can also use percentages for heights:

[pw_map address="New York City" width="50%" height="200px" key="YOUR API KEY"]

Can I disable the scroll wheel?

Yes, simple add enablescrollwheel="false" to the maps shortcode.

[pw_map address="New York City" enablescrollwheel="false" key="YOUR API KEY"]

Can I disable the map controls?

Yes, simple add disablecontrols="true" to the shortcode.

[pw_map address="New York City" disablecontrols="true" key="YOUR API KEY"]

How are the maps cached?

Maps are cached using the WordPress Transients API, which allows for very efficient and WordPress standard database-based caching.

Each time you display a map, the address specified is used to generate a unique md5 hash, which is used for the cache identifier. This means that if you change the address used for your map, the cache will be refreshed.

For testing ONLY if you want to not use the cache then specify force=true

e.g.

[pw_map address="New York City" force="true" key="YOUR API KEY"]

How often do caches refresh?

The maps are cached for 3 months. Caches are automatically cleared (for individual maps) when you change the address in the shortcode.

Can I specify multiple pins?

Yes simply separate addresses with a semi-colon ; the map will center on the first pin

[pw_map address="New York City;New Jersey" zoom="8" key="YOUR API KEY"]

How do I change the initial zoom?

Initial zoom can be controlled with teh shortcode option zoom= the default is zoom=15 use for instance zoom=10 to zoom out

[pw_map address="New York City" zoom="8" key="YOUR API KEY"]

Why do I get REQUEST_DENIED error?

This is likely to be an issue with the authorization you granted to your API key see Google API REQUEST_DENIED troubleshooting

It is recommended that you set an Application Restriction to restrict your API key from others using it.

However restricting the referrer HTTP will cause this error ‘API keys with referer restrictions cannot be used with this API’, this is because the geoencoding is performed server side and cached server side, so there is no browser referrer.
If you get this message change your restriction to IP addresses (web servers, cron jobs, etc.) using the IP address of your website.

If you restrict your API key to specific APIs make sure you enable at least
* Maps JavaScript API
* Geocoding API

使用者評論

2022 年 4 月 15 日
Does the job. We use it on multiple sites.
2022 年 4 月 5 日
I have a site that uses custom pods. I couldn't get any of the other map plugins to pick up the addresses. I was going to have to manually enter thousands. I was able to drop this code in and WHAM every custom place had a map!
2022 年 1 月 25 日
It's so simple and easy to use! Best Google Map shortcode plugin I’ve ever seen. You guys are simply the best!
2022 年 1 月 11 日
I tried other map plugins and all I wanted to do was to display a Google map with an address pinned. Believe it or not, the more well known plugins, that do a TON of stuff, could not handle this simple request. I found this plugin and within about 5 minutes I had the map displaying on my site with a dynamic pin for the address based on the page I was on. Worked first time and has never given me any issues. So if all you want to do is display a map, and highlight an address, then this is the plugin for you!
閱讀全部 37 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Simple Shortcode for GoogleMaps〉的開發相關工作。

參與者

Simple Shortcode for GoogleMaps 外掛目前已有 3 個本地化語言版本。 感謝全部譯者為這個外掛做出的貢獻。

將〈Simple Shortcode for GoogleMaps〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

1.5.3

  • update donation library

1.5.2

  • Further improve error output to assist problem resolution

1.5.1

  • Improve error output to assist problem resolution

1.5

  • Allow multiple address pins

1.4.1

  • load google maps cookieless to help with GDPR compliance

1.4.0

  • add donation info to settings

1.3.3

  • Fix block editor issue

1.3.2

  • Fix: few API key related issues

1.3.1

  • Fix: API key was not passed to the pw_map_get_coordinates() function

1.3

  • Added key parameter to the [pw_map] shortcode.

1.2

  • Added missing load_plugin_textdomain()
  • Changed textdomain for language packs

1.1.2

  • Fixed a bug with the zoom parameter not working

1.1.1

  • Fixed a bug with sites on HTTPS

1.1

  • Added support for disabling map controls via disablecontrols=”true”, thanks to Alex Hochberger
  • Added support for disabling the scroll wheel zoom via enablescrollwheel=”false”, thanks to Alex Hochberger

1.0.3

  • Fixed a conflict with the Live Composer plugin.

1.0.2

  • Updated Google Maps API to fix broken maps after version 2 was deprecated on March 8, 2013
  • Improved error responses

1.0.1

  • Added CSS to fix a problem with responsive themes

1.0

  • First release!