开发者 |
fullworks
alanfuller |
---|---|
更新时间 | 2024年11月1日 04:12 |
捐献地址: | 去捐款 |
WordPress版本: | 6.7 |
版权: | GPLv2 or later |
版权网址: | 版权信息 |
[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"]
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"]
Yes, simple add enablescrollwheel="false"
to the maps shortcode.
[pw_map address="New York City" enablescrollwheel="false" key="YOUR API KEY"]
Yes, simple add disablecontrols="true"
to the shortcode.
[pw_map address="New York City" disablecontrols="true" key="YOUR API KEY"]
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"]
The maps are cached for 3 months. Caches are automatically cleared (for individual maps) when you change the address in the shortcode.
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"]
Initial zoom can be controlled with the 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"]
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
For developer documentation on filters visit here https://fullworksplugins.com/docs/developers-simple-shortcode-for-google-maps/