Current Location Shortcode

Using the Current Location shortcode you can display the visitor's current location information within the content of your pages, posts and a template file.

The basic  shortcode is:

[gmw_current_location]

Below you can learn about the attributes that you can use with the Current Location shortcode in order to modify its features:

Current Location Shortcode Attributes

  • element_id - The element ID is a unique ID you can apply to the Current location shortcode. The element ID is useful when you want to apply custom styling to a specific shortcode or make a use of the hooks provided by it. The element ID will help you distinguish between the different Current 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 Single Location widget/shortcode.
    Example:

    [gmw_current_location element_id="18"]
  • 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:

    • Username - display the username for logged-in users or "guest" for logged-out users with a greeting message.
    • address - Display the address of the visitor's current position.
    • location_form - the location form that the visitor can use to detect his current location.
    • map - Google map showing the current location of the visitor.

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

    [gmw_current_location elements="username,address,location_form,map"]
  • location_form_trigger - The text that you would like to display as the location form trigger and will show above the location form. Once clicked, the trigger will show and hide the location form.
    Usage - enter any text that you would like to use as the form trigger. Otherwise, use the value 0 if you wish to hide it.
    Example:

    [gmw_current_location location_form_trigger="Get your current location"]
  • 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_current_location address_fields="city,country"]
  • address_label - the text that you would like to display before the address.
    Usage - enter any text as you wish. Otherwise, use 0 to disable it.
    Example:

    [gmw_current_location address_label="Your Location"]
  • user_greeting - The text that you would like to display before the username. For example enter "Hello " in order to show "Hello {username}".
    Usage - You might use any text as you wish.
    Example:

    [gmw_current_location user_greeting="Hello"]
  • guest_greeting - The text that you would like to display when a logged-out user is visiting your site.
    Usage - You might use any text as you wish.
    Example:

    [gmw_current_location user_greeting="Hello guest!"]
  • map_height - the map height.
    Usage - set the map height in pixels or percentage ( ex. 250px or 100% ).
    Example:

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

    [gmw_current_location map_width="100%"]
  • map_icon - the map icon/marker.
    Usage - Enter the URL of the image that you would like to use as the map icon.
    Example:

    [gmw_current_location item_map_icon="https://maps.google.com/mapfiles/ms/icons/blue-dot.png"]
  • map_type - set 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_current_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_current_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_current_location scrollwheel_map_zoom="0"]