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 template files.

Shortcode Usage

[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.


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 use 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 and 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.

Default value: Update your current location.

Example:
[gmw_current_location location_form_trigger="Get your current location"]

clear_location_trigger

The text that you would like to use as the link that will clear the location from the form and cookies

Usage: enter any text that you would like to use.

Default value: clear location.

Example:
[gmw_current_location clear_location_trigger="clear location"]

address_fields

The address fields that you would like to display. You can use 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.

Default value: city,country.

Example:
[gmw_current_location address_fields="city,country"]

address_label

The text that you would like to display as a label before the address.

Usage: enter any text as you wish. Otherwise, use 0 to disable it.

Default value: 0.

Example:
[gmw_current_location address_label="Your Location"]

user_greeting

The text that will be displayed before the username. For example, enter "Hello " in order to show "Hello {username}".

Usage: You might use any text as you wish.

Default value: Hello.

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.

Default value: Hello, guest!.

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% ).

Default value: 200px.

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% ).

Default value: 200px.

Example:
[gmw_current_location map_width="100%"]

map_icon_url

Set custom map icon/marker.

Usage: enter the URL of the image that you would like to use as the map icon.

Example:
[gmw_current_location map_icon_url="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, and TERRAIN.

Default value: ROADMAP.

Example:
[gmw_current_location map_type="TERRAIN"]

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 between 1 and 18.

Default value: 8.

Example:
[gmw_current_location zoom_level="13"]

scrollwheel_zoom

Enable/disable map zooming using the mouse scrollwheel.

Usage: by default, the attribute is set to 1. Set it to 0 if you wish to disable zooming using the mouse scroll wheel.

Example:
[gmw_current_location scrollwheel_zoom="0"]

loading_message

The message displayed while retriving the current location.

Usage: use any text as you wish.

Default value: Retrieving your current location...

Example:
[gmw_current_location loading_message="Loading your location"]