Maps Shortcodes

wpv-map-marker

Description
Adds a marker on a map.
Arguments
  • map_id. Mandatory. The unique ID for the map where this marker will be rendered. Must be a string.
  • marker_id. Mandatory. The unique ID for this marker. Must be a string.
  • marker_title. Optional, defaults to empty. When empty, and the marker comes from a meta field, it will automatically be populated with the post title, term name or user nicename. Shown when you hover over a marker.
  • id. Optional, defaults to empty. The ID of the object used to get the address meta field value for this marker.
  • marker_field. Optional. Source of the marker location when displaying a marker from an address postmeta field.
  • marker_termmeta. Optional. Source of the marker location when displaying a marker from an address termmeta field. When used on a View listing taxonomy terms, it uses the termmeta field from the current term in the View loop. Otherwise, you need to pass a value with the id attribute.
  • marker_usermeta. Optional. Source of the marker location when displaying a marker from an address usermeta field. When used on a View listing users, uses the usermeta field from the current user in the View loop. Otherwise, you need to pass a value using the id attribute.
  • address. Optional. Defaults to empty. Another optional source of the marker address, allows to display a marker given a fixed, known address.
  • lat and lon. Optional, both default to empty. Another optional source of the marker location, allows to display a marker given its latitude and longitude coordinates. Both values need to be passed.
  • marker_icon. Optional, defaults to empty, which means using the default Google Maps icons for markers, or the one set for the whole map. Can be a complete URL pointing to an image to use as marker image.
  • marker_icon_hover. Optional, defaults to empty, which means using the default Google Maps icons for markers or the one set for the whole map. Can be a complete URL pointing to an image to use as marker image when hovering over it.
Output
The marker of a map.

More Usage examples

Example
[wpv-map-marker map_id="my-map" marker_id="my-marker" marker_title="This is a marker" marker_field="wpcf-my-marker"]This is the content of the marker popup.[/wpv-map-marker]

wpv-map-render

Description
Renders a map.
Arguments
Output
A map on the frontend.

More Usage examples

Example
[wpv-map-render map_id="my-map" map_width="400px" map_height="200px" fitbounds="off" general_zoom="6" single_zoom="15" cluster="on"]

Extra Elements

There are some elements that are not actual shortcodes, but also provide interaction with maps.

Map focus on marker

Description
This is a clickable HTML element that focus on a marker of a map.
Arguments
  • A class with the value js-wpv-addon-maps-focus-map.
  • A data attribute data-map holding the value of the map ID to focus on.
  • A data attribute data-marker holding the value of the marker ID to focus on.
Output
A clickable element that focus on a marker of a map.

More Usage examples

Example
<button class="js-wpv-addon-maps-focus-map" data-map="my-map" data-marker="my-marker">Focus on marker</button>

Map reload

Description
This is a clickable HTML element that reloads a map.
Arguments
  • A class with the value js-wpv-addon-maps-reload-map.
  • A data attribute data-map holding the value of the map ID to reload.
Output
A clickable element that reloads a map.

More Usage examples

Example
<button class="js-wpv-addon-maps-reload-map" data-map="my-map">Reload the map</button>

Map zoom restore

Description
This is a clickable HTML element that restores the zoom of a map.
Arguments
  • A class with the value js-wpv-addon-maps-restore-map.
  • A data attribute data-map holding the value of the map ID to restore the zoom.
Output
A clickable element that restores the zoom of a map.

More Usage examples

Example
<button class="js-wpv-addon-maps-restore-map" data-map="my-map">Restore zoom of the map</button>