Single Location Shortcode

Using the Single Location shortcode you can display the location information of a particular item. Item can be a post, BuddyPress member and others that might be provided by premium add-ons. You can use the shortcode to display the location information within the content of your pages, posts and a template file. You can display elements like Google map, title, directions link, live directions and more.

The basic Single Location shortcode is:

[gmw_single_location]

Below you can learn about the attributes that you can use with the Single Location shortcode:

Single Location Shortcode Attributes

  • item_type - The item which you would like to display the location for. Item can be a post ( when using the Post Types Locator add-on ), member ( when using Members Locator add-on ) and other items which might be provided by different premium add-ons.
    Usage - Enter the item type that you would like to use.
    Example:

    [gmw_single_location item_type="post"]
  • element_id - The element ID is a unique ID you can apply to the Single location shortcode. The element ID is useful when you want to apply custom styling to a specific Single Location shortcode or make a use of the hooks provided by the shortcode. The element ID will help you distinguish between the different Single Location shortcodes.
    Usage - Use any characters as you wish. Otherwise, the plugin will create a random numeric value for you made up of 3 digits. Make sure you do not use the same element ID with more than one shortcode. As well make sure that the element ID that you choose is not being used by GEO my WP forms or the Current Location widget/shortcode.
    Example:

    [gmw_single_location element_id="18"]
  • item_id - Item ID is the ID of the item that you want to display. For example, the item ID of a post will be the post ID. Same goes for member ID and other items.Usage - To display the location of a specific item use its item ID with the item_id attribute. Otherwise, set it to 0 ( item_id="0") if you want the item to be displayed automatically based on the single item page. For example, if the item ID of a post set to 0 then the shortcode will display its content on a single post page. In this case, it is the location of the post that is being display ( if location assigned to the post ).
    Example:

    [gmw_single_location item_id="11"]
  • elements - The elements that you would like to display. You can choose a single or multiple elements. You can also set the order that you would like to display the elements. The elements available are:
    • title - the title of the item. The title of post will be the post title, the title of member will be its displayed name and same for other elements.
    • address - the address fields of the location.
    • map - Google map showing the locaiton of the item.
    • distance - The distance between the location to the user's current locaiton ( if exists ).
    • directions_link - direction link that will open a new page with Google map showing the directions from the location to the user's current location if exsits.
    • live_directions - display directions system within the shortcode content.
    • directions_panel - The holder that will display the directions results ( must have live_directions element set ).

    Usage - Enter the elements that you would like to display, in the order that you would like to display them, comma separated.
    Example:

    [gmw_single_location elements="title,distance,map,address,live_directions,directions_panel"]
  • address_fields - The address fields that you would like to display. You can choose a single or multiple address fields. The fields available are street, apt, city, state, zipcode, county and address ( for full address ).
    Usage - Enter any of the address fields that you would like to display comma separated.
    Example:

    [gmw_single_location address_fields="city,state,country"]
  • additional_info - The additional information fields that you would like to display ( this attribute only available with post at the moment).Usage - Enter the additional fields that you would like to display, comma separated. The available fields are:
    • phone
    • fax
    • email
    • website

    Example:

    [gmw_single_location additional_info="phone,fax,email,website"]
  • units - the distance units you would like to use when calculating the distance between the displayed location and the user's current location, when exists.
    Usage - set the units attribute to "m" form mile or "k" fcor Kilometers.
    Example:

    [gmw_single_location units="m"]
  • map_height - the map height.
    Usage - set the map height in pixels or percentage ( ex. 250px or 100% ).
    Example:

    [gmw_single_location map_height="300px"]
  • map_width - the map width.
    Usage - set the map width in pixels or percentage ( ex. 250px or 100% ).
    Example:

    [gmw_single_location map_width="100%"]
  • map_type - Choose the map type.
    Usage - enter the map type that you would like to use. The available map types are:

    • ROADMAP
    • SATELLITE
    • HYBRID
    • TERRAIN

    Example:

    [gmw_single_location map_type="ROADMAP"]
  • zoom_level - the zoom level defines the resolution of the current view. Zoom levels between 0 (the lowest zoom level, in which the entire world can be seen on one map) and 18 (down to streets and individual buildings) are possible.
    Usage - enter a numeric value that will be used as the zoom level.
    Example:

    [gmw_single_location zoom_level="13"]
  • scrollwheel_map_zoom - Enable/disable map zoom in/out using the mouse scroll wheel
    Usage - By default the attribute is set to 1. Set it to 0 if you want to disable the map's zoom using the mouse scroll wheel.
    Example:

    [gmw_single_location scrollwheel_map_zoom="0"]
  • item_map_icon - the map icon/marker that represents the item's location on the map.
    Usage - Enter the URL of the image that you would like to use as the item's map icon.
    Example:

    [gmw_single_location item_map_icon="https://maps.google.com/mapfiles/ms/icons/red-dot.png"]
  • item_info_window - the elements that you would like to display in the info-window ( the pop-up information window that opens with a click on the map marker ) of the item.
    Usage - enter the elements, comma separated, that you would like to display in the item's info-window. Otherwise, leave it empty to disable the info-window. The elements available are:

    • distance
    • title
    • address
    • additional_info ( available for post only )

    Example:

    [gmw_single_location item_info_window="distance,title,address,additional_info"]
  • user_map_icon - the map icon/marker which represents the user's current position ( if exists ) on the map. Otherwise, set it to 0 if you want to disable the user's map marker.
    Usage - enter the URL of the image that you would like to use as the user's map marker.
    Example:

    [gmw_single_location user_map_icon="https://maps.google.com/mapfiles/ms/icons/blue-dot.png"]
  • user_info_window - the text that you would like to display in the info-window of the map marker that represents the user's current location.
    Usage - Enter the content that you would like to display in the info-window. Otherwise, leave it empty to disable the info-window.
    Example:

    [gmw_single_location user_info_window="You are here"]
  • no_location_message - the message that will display if no location exists for the item that is being displayed.
    Usage - Enter the message that you would like to display. Otherwise, set it to 0 to hide the message.
    Example:

    [gmw_single_location no_location_message="No location found"]