@ shanna
Since we last emailed I have released a couple updates…
The first, I implemented multi-service provider geocoding support. When the Google Maps Server API key has not been setup, Connections will now default to a free geocoding provider, Algolia. They are basically a OSM provider.
The other, released today, extends this support to the maps being displayed. If the Google Maps Browser API has not been setup, Connections will now default to displaying maps from Wikimedia.
This update also include a new general purpose map shortcode. I’ve added this mostly so I can more easily test code as I develop it.
The basic options match the shortcode plugin you shared with me. Although the actual implementation differs greatly.
Basic usage:
[cn-mapblock]
This would simply display a map, centered in the US, zoomed in on a marker. The default will eventually be pulled from the Region/Country defined by the user on the Connections : Settings admin page under the General tab.
[cn-mapblock zoom=3 marker=no]
This will change the zoom so you can see the entire US and no marker.
[cn-mapblock latitude=40.3887 longitude=-78.6722 zoom=13]
This will create a map with a marker at a specific location with a marker.
[cn-mapblock latitude=40.3887 longitude=-78.6722 zoom=13]Marker popup content.[/cn-mapblock]
To add a popup to the marker, put the popup content between the opening and closing shortcode. It supports HTML :)
You can also add multiple markers to the map and set the map height, like so:
[cn-mapblock latitude=40.3356 longitude=-75.9269 zoom=13 height=600px]
<strong>Map</strong> pin!
[mapmarker latitude=40.3887 longitude=-78.6722/]
[mapmarker latitude=40.1098 longitude=-76.5033]<strong>Marker</strong> pin![/mapmarker}
[/cn-mapblock]
This will set a map marker with a popup and two additional markers, one with a popup, the other will be just a marker. To turn off the map level marker, add marker=no
to the shortcode and remove the marker popup content, <strong>Map</strong> pin!
. Like this:
[cn-mapblock latitude=40.3356 longitude=-75.9269 marker="no"]
[mapmarker latitude=40.3887 longitude=-78.6722/]
[mapmarker latitude=40.1098 longitude=-76.5033]<strong>Marker</strong> pin![/mapmarker}
[/cn-mapblock]
Now you’ll just two markers, one with a popup.
It can actually get crazier than this because the shortcode also supports multiple layers and adding markers to the individual layers. At that point, I think someone would be better off using a map builder plugin because that can get ugly looking real quick. This was added mostly for my testing.
You can also use the shortcode on the page more than once. But, due to the nature of nesting shortcodes and WP being “greedy” when parsing for them, you might have to self close a shortcode. Something you normally do not need to worry about. Here’s an example:
[cn-mapblock zoom=3 marker=no/]
Notice that slash in the shortcode… if you are nesting shortcodes and something is not working right, try self closing the shortcodes.
And one last thing… the maps lazy load! They will only load when the are within the window viewport. :)
Any way, that’s all. Hope you find this helpful!