Shortcodes Guide

The Open User Map plugin provides several Shortcodes to display locations, filter content, and customize the map’s appearance and functionality.

👉 You can find a list of the currently available Shortcodes and their attributes for your plugin version in the plugin settings ( Open User Map > Settings > Help & Getting Started ).

This guide outlines the available Shortcodes and their attributes.

Basic Shortcode for Displaying the Map

To display the map with all locations, use the following shortcode:

[open-user-map]

If integrating into a theme file, use:

PHP
<?php echo do_shortcode('[open-user-map]'); ?>

This will display the default map as configured in the plugin settings.

Shortcode Attributes

Map Position & View

Customize the map’s initial position and zoom level:

AttributeExampleDescription
latlat="51.50665"Set latitude for the initial map position.
longlong="-0.12752"Set longitude for the initial map position.
zoomzoom="13"Define the initial zoom level.
regionregion="Europe"Pre-select a region (must be enabled in settings).

Content Filtering

Filter the displayed locations based on categories, users, or specific IDs:

AttributeExampleDescription
typestypes="food"
types="food|drinks|hotel"
Filter locations by types (Marker Categories). Separate multiple types with a | symbol.
idsids="123"
ids="123|456|789"
Filter locations by Post ID. Separate multiple IDs with a | symbol.
user (PRO)user="current"
user="123"
user="role:subscriber"
Filter locations by user. Use “current” to show only locations from the currently logged-in user, a specific user ID, or “role:rolename” to show locations from users with a specific role.

Display & Appearance

Customize the map’s size and layout:

AttributeExampleDescription
sizesize="default"
size="fullwidth"
Set a custom map size for desktop.
size_mobilesize_mobile="square"
size_mobile="landscape"
Set a custom size for mobile view.
heightheight="400px"Define a custom height for desktop (include units like px).
height_mobileheight_mobile="300px"Define a custom height for mobile.
map_typemap_type="interactive"
map_type="simple"
Enable or disable the “Add location” button.
map_stylemap_style="Esri.WorldStreetMap"Override the default map style.

Features & Controls

Enable or disable specific map features:

AttributeExampleDescription
disable_regionsdisable_regions="true"
disable_regions="false"
Enable or disable Regions.
enable_clusterenable_cluster="true"
enable_cluster="false"
Enable or disable marker clustering.
enable_searchbarenable_searchbar="true"
enable_searchbar="false"
Enable or disable the searchbar.
enable_searchaddress_buttonenable_searchaddress_button="true"
enable_searchaddress_button="false"
Enable or disable the “Search for Address (Geosearch)” button.
enable_searchmarkers_buttonenable_searchmarkers_button="true"
enable_searchmarkers_button="false"
Enable or disable the “Search for Markers” button.
enable_currentlocationenable_currentlocation="true"
enable_currentlocation="false"
Enable or disable the “Show me where I am” button.
enable_fullscreenenable_fullscreen="true"
enable_fullscreen="false"
Enable or disable the fullscreen mode.

Complete Examples

Example 1: Map of London Showing Only Food Locations

[open-user-map lat="51.50665" long="-0.12752" zoom="13" types="food" size="fullwidth" height="500px"]

Example 2: Simple Map Showing Only the Current User’s Locations (PRO)

[open-user-map map_type="simple" user="current" enable_fullscreen="true" enable_searchbar="false"]

Example 3: Interactive Map for a Specific Region with Custom Appearance

[open-user-map region="Europe" map_type="interactive" height="600px" enable_cluster="false" enable_currentlocation="true"]

Additional Shortcodes

Display Specific Location Data

The [open-user-map-location] shortcode allows you to display details from a specific location.

Usage

[open-user-map-location value="title" post_id="12345"]

Available Values

  • title
  • image
  • audio
  • video
  • type
  • map
  • address
  • lat
  • lng
  • route
  • text
  • notification
  • author_name
  • author_email
  • wp_author_id
  • Custom fields (Use the field label)

If post_id is omitted, it will use the current post.

The [open-user-map-gallery] shortcode generates a gallery of location images.

Available Attributes

AttributeExampleDescription
urlurl="https://mysite.com/"Link the images to another page.
numbernumber="10"Limit the number of displayed images.
useruser="current"
user="123"
user="role:subscriber"
Filter images by user. Accepts “current”, a user ID, or “role:rolename”.

Example Usage

[open-user-map-gallery number="10" user="current"]

Display a List of Locations

The [open-user-map-list] shortcode generates a paginated list of locations.

Available Attributes

AttributeExampleDescription
useruser="current"Filter locations by user. Accepts “current”, a user ID, or “role:rolename”.
typestypes="food|drinks"Filter by marker categories. Separate multiple types with a | symbol.
idsids="123|456"Filter by location IDs. Separate multiple IDs with a | symbol.

Example Usage

[open-user-map-list user="current" types="food|drinks"]

Summary

The Open User Map plugin provides flexible shortcodes for displaying and filtering maps, customizing layouts, and adding extra features like galleries and location lists. Use the attributes outlined above to tailor the output to your needs.

For additional customization, explore the plugin settings under Open User Map > Settings in your WordPress dashboard. 🚀

Was this article helpful?

Related Articles


EN