To add a Flexible Map to a post or a page, add a shortcode [flexiblemap] and give it some useful parameters.
Map can either be specified using centre coordinates, or by loading a KML file.
Parameters for all maps:
- width
- width in pixels, e.g. width="500"
- height
- height in pixels, e.g. height="400"
- zoom
- zoom level as an integer, larger is closer, e.g. zoom="16"
- maptype
- type of map to show, from [roadmap, satellite], e.g. maptype="roadmap"; default=roadmap
- hidemaptype
- hide the map type controls, from [true, false], e.g. hidemaptype="true"; default=false
- hidepanning
- hide the panning controls, from [true, false], e.g. hidepanning="true"; default=true
- hidezooming
- hide the zoom controls, from [true, false], e.g. hidezooming="true"; default=false
- hidestreetview
- hide the street view control, from [true, false], e.g. hidestreetview="true"; default=true
- hidescale
- hide the map scale, from [true, false], e.g. hidescale="true"; default=true
- scrollwheel
- enable zoom with mouse scroll wheel, from [true, false], e.g. scrollwheel="true"; default=false
- draggable
- enable dragging to pan, from [true, false], e.g. draggable="true"; default=true
- dblclickzoom
- enable double-clicking to zoom, from [true, false], e.g. dblclickzoom="true"; default=true
Additional parameters for centre coordinates map:
- center
- coordinates of centre in latitude,longitude, e.g. center="-34.916721,138.828878"
- marker
- coordinates of the marker if different from the centre, in latitude,longitude, e.g. marker="-34.916721,138.828878"
- title
- title of the marker, displayed in a text bubble, e.g. title="Adelaide Hills"
- link
- URL to link from the marker title, e.g. link="http://example.com/"
- description
- a description of the marker location (can have HTML links), e.g. description="Lorem ipsum dolor sit amet"
- directions
- show directions link in text bubble; by default, directions will be displayed underneath map, but you can specify the element ID for directions here.
- showinfo
- show the marker's info window when the map loads, from [true, false], e.g. showinfo="true"; default=true
- Samples:
[flexiblemap center="-34.916721,138.828878" width="500" height="400" zoom="9" title="Adelaide Hills" description="The Adelaide Hills are repleat with wineries."]
[flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="true"]
[flexiblemap center="-34.916721,138.828878" width="500" height="400" title="Adelaide Hills" directions="my-dir-div"]
Additional parameters for KML map:
- src
- URL for KML file to load map details from, e.g. src="http://example.com/map.kml"
[flexiblemap src="http://snippets.webaware.com.au/maps/example-toronto.kml" width="500" height="400"]
Calling from templates or plugins
There is a PHP function `flexmap_show_map()` for theme and plugin developers. All of the same parameters for the shortcode can be passed to the function in an associative array.
- Sample:
flexmap_show_map(array(
'center' => '-34.916721,138.828878',
'width' => 500,
'height' => 400,
'zoom' => 12,
'title' => 'Adelaide Hills',
'description' => 'The Adelaide Hills are repleat with wineries.',
'directions' => 'my-dir-div',
));