/

CM Map Locations (CMML) - Using Shortcodes


Shortcodes

Back to User Guide

What are shortcodes

Shortcodes allow you to add a dynamic map with your locations to posts and pages. There are different shortcodes depending on what you want to display. To use them, you must identify locations or categories by their IDs - learn how to display these in the edit pages.

Additionally, you can make them more specific by using attributes. For instance you can use "category=tech" to only show that specific category.

Below, we list all the shortcodes and their attributes, along with samples to make it easier to understand. 

For reference, you can always find the list of shortcodes listed under the Shortcodes option.


Locations Shortcodes

1) Snippet

  • Shortcode: [cmloc-snippet id=x]
  • Use: Displays a location's snippet. You can edit what is shown on the snippet under the Settings tab. Learn more by checking the related article on editing settings.
  • Attributes:
    • id - set location ID to display specific location map.
    • featured - set map to display interactive map or image for static image.
  • Sample: By using the shortcode [cmloc-snippet id="487" featured="map"], we are able to add a snippet of this location to the blog post.

2) A Specific Location Map

  • Shortcode: [cmloc-location-map id=x]
  • Use: Shows a specific location on a map.
  • Attributes:
    • id - location ID
    • mapwidth - width of the map in pixels (decimal value without px string)
    • mapheight - height of the map in pixels (decimal value without px string)
    • width - width of the entire widget in pixels (decimal value without px string)
    • showtitle - 0 for no, 1 for yes
    • showdate - 0 for no, 1 for yes
  • Sample:[cmloc-location-map id=1767 mapwidth=640 mapheight=480 width=700 showtitle=1 showdate=1]

3) Multiple Locations Map

  • Shortcode: [cmloc-locations-map category=x]
  • Use: Displays maps with locations from a chosen category
  • Attributes:
    • list - Choose between:
      • none
      • left
      • right
      • bottom
      • compact
    • limit - maximum number of locations (e.g. 5)
    • category - set category ID/slug to displays locations from this category.
    • mapwidth - width of the map in pixels (decimal value without px string)
    • mapheight - height of the map in pixels (decimal value without px string)
    • width - width of the entire widget in pixels (decimal value without px string)
    • menu - show or hide a menu above the map with the buttons All locations, Add Locations and My Locations ("1" to show, "0" to hide)
    • tooltip - show or hide the info tooltip when a user clicks on a location  ("1" to show, "0" to hide) 
    • showonlybyparams - makes the index show only a specific map. Set as 1 in the page used for sharing locatios.
      In technical terms, when enabled, the index will take the query of the URL in account
  • Sample 1: With [cmloc-locations-map category="mountains"], we are able to display a map with all locations from a single category.

  • Sample 2: With [cmloc-locations-map list=left limit=4 page=1 category="111"], we can display the map with a list of locations.


4) My locations table

  • Shortcode: [my-locations-table]
  • Use: Displays the user's location table, the same that is showing up in the user's dashboard
  • Attributes:
    • controls - set "1" (default) if you want to show the "Edit" and "Delete" buttons for each location or "0" if you don't.
    • addbtn - set "1" (default) if you want to show the "Add location" button or "0" if you don't.
  • Sample[my-locations-table controls=1 addbtn=1]

Integration Shortcodes

1) Common Map with Routes Integration

  • Shortcode: [cmmrm-cmloc-common-map]
  • Use: Displays a common map with locations and routes from the CM Map Routes Manager plugin
  • Attributes:
    • path - set "1" if you want to display path or "0" if not.
    • categoryfilter - Show/Hide category filter above the map. 0 for hide, 1 for show. Includes categories for both plugins (Map Routes and Map Locations)
    • categoryfilterautoselect - selects certain categories as soon as the page loads. Input the categories' id, separated by commas.
      Only works if  categoryfilter="1" 
    • mapwidth - width of the map in pixels (decimal value without px string)
    • mapheight - height of the map in pixels (decimal value without px string)
    • width - width of the entire widget in pixels (decimal value without px string)
  • Sample[cmmrm-cmloc-common-map path=1 categoryfilter=1 categoryfilterautoselect=1,5,22 mapwidth=900 mapheight=500 width=900]


2) Business Directory Integration

  • Shortcode: [cmloc-business]
  • Use: Displays map with the CM Business Directory records.
  • Attributes:
    • category - set business category to display business on the map,
    • categoryfilter - show or hide category filter over the map,
    • mapwidth - width of the map in pixels (decimal value without px string)
    • mapheight - height of the map in pixels (decimal value without px string)
    • width - width of the entire widget in pixels (decimal value without px string)
  • Sample[cmloc-business category=tech categoryfilter=1 mapwidth=640 mapheight=480 width=700]

More information about the CM Locations Manager WordPress  Plugin

Other WordPress products can be found at CreativeMinds WordPress Store

Let us know how we can Improve this Product Documentation Page

To open a Support Ticket visit our support center