Shortcodes

  1. Store Locator
  2. Store Address
  3. Opening Hours
  4. Store Map

Store Locator

The [wpsl] shortcode shows the full store locator: the search form, the map and the results list. Every attribute is optional. Anything you leave out falls back to the value on the settings page.

Attribute What it does
template The id of the template to use. The built-in templates are default, horizontal and vertical (below_map from version 2 is mapped to horizontal). You can add your own with the wpsl_templates filter.
start_location Where the start marker is placed. Accepts an address or lat,lng coordinates.
auto_locate Try to detect the visitor’s location with the Geolocation API (true / false)
category Restrict the results to one or more category slugs. The category filter is hidden, because the results are already filtered in the background.
exclude_category Leave one or more categories out of the results
category_filter Show or hide the category filter (true / false)
category_filter_type Show the category filter as a dropdown or as checkboxes
category_selection Preselect a category. A dropdown takes a single slug, checkboxes take several.
category_parent_id Only list the child categories of this parent in the filter
checkbox_columns The number of columns used by the category checkboxes, from 1 to 4 (default 3)
radius_filter Show or hide the search radius dropdown
results_filter Show or hide the number of results dropdown
map_type roadmap, satellite, hybrid or terrain. See the Google Maps map types.
map_style Override the map style for this locator
map_id Use a specific Google cloud-based Map ID (Google Maps only)
start_marker Marker used for the start location: blue, dark-blue, green, dark-green, orange, dark-orange, pink, purple, red, or the name of your custom marker
store_marker Marker used for the locations. Takes the same values as start_marker.
active_marker Marker used for the location the visitor selected
marker_labels Show labels on the markers: numbers, letters or none
marker_clusters Turn marker clustering on or off for this map (marker_cluster is accepted too)
city / state / country Restrict the results to one city, state or country
distance_unit km or mi for this locator
shapes Draw the map shapes on this map (true / false, default true)

If you set city, state or country without also setting start_location, the map works out its own starting point from that restriction. Otherwise you could end up with the start location from the settings page, London for example, on a map that only shows Canadian locations.

Example how to restrict the results to the fast-food and italian categories

[wpsl template="default" category="fast-food,italian" start_location="times square,new york"]

Example how to show the checkboxes with the bmw, mercedes and porsche categories selected. It also uses a blue marker as the start marker, and a green marker as the store marker.

[wpsl template="default" category_filter_type="checkboxes" category_selection="bmw,mercedes,porsche"
start_location="times square,new york" start_marker="blue" store_marker="green"]

Example of a locator locked to Belgium, in kilometres, without the radius and results dropdowns

[wpsl country="Belgium" distance_unit="km" radius_filter="false" results_filter="false"]
If you need multiple maps on the same page, you will have to use the [wpsl_map] shortcode. It is not possible to do this with the [wpsl] shortcode.

Store Address

The [wpsl_address] shortcode shows the address details together with the contact details.

Attribute What it does
id The id of the location to show the address for. Only required when the shortcode isn’t used on a store location page.
name Show the name (true / false, default true)
address Show the address (default true)
address2 Show the second address line (default true)
city Show the city (default true)
state Show the state (default true)
zip Show the zip code (default true)
country Show the country (default true)
contact_details Show or hide the Phone / Fax / Email / Url block in one go
phone Show the phone number
fax Show the fax number
email Show the email address
url Show the url
clickable_contact_details Make the phone number and email address clickable
bold_contact_details Wrap the Phone / Fax / Email / Url labels in <strong> (default true)
directions Show a directions link that opens the route in Google Maps (default false)

The phone, fax, email and url details default to the contact details setting on the settings page. contact_details switches all four at once, but a single attribute still wins, so contact_details="false" phone="true" shows only the phone number.

Example:

[wpsl_address id="4" name="true" address="true" address2="false"
city="true" state="false" zip="true" country="true" phone="true"
fax="false" email="true" url="true"]

Opening Hours

The [wpsl_hours] shortcode shows the opening hours of a location.

Attribute What it does
id The id of the location to show the opening hours for. Only required when the shortcode isn’t used on a store location page.
hide_closed Hide the days the location is closed (true / false)
current_status Show the live Open / Closed status
expand_status Let visitors expand the status to see the full week

All three default to what you picked on the settings page, so you only need them when one page should differ from the rest.

Example:

[wpsl_hours id="4" hide_closed="true" current_status="true"]

Store Map

The [wpsl_map] shortcode shows one or more locations on a map, but without the search form.

Attribute What it does
id The id of the location(s) to show on the map. Only required when the shortcode isn’t used on a store location page, or when you want to show multiple locations.
category Restrict the plotted locations to one or more category slugs
city / state / country Restrict which locations are plotted
width The width of the map in pixels (default 100%)
height The height of the map in pixels
zoom The zoom level, from 1 to 21. Ignored when category is used, because the map then zooms to fit all the markers.
map_type roadmap, satellite, hybrid or terrain
map_type_control Show the map type controls (true / false)
map_style Override the map style for this map. With Google Maps, default ignores the custom map style from the settings page.
map_id Google cloud-based Map ID (Google Maps only)
street_view Show the option to enable Street View (true / false)
scrollwheel Enable or disable zooming with the scroll wheel (true / false)
control_position Position of the map controls, left or right
store_marker Marker used for the plotted locations
active_marker Marker used for the selected location
marker_clusters Clustering for this map only (marker_cluster is accepted too)
shapes Draw the map shapes on this map (true / false, default true)

Anything you leave out uses the value from the settings page. Clustering is deliberately per map: switching it on for a [wpsl_map] does not switch it on for the [wpsl] locator elsewhere on the site.

Example:

[wpsl_map id="2" width="500" height="350" zoom="5" map_type="roadmap"
map_type_control="true" map_style="default" street_view="false"
scrollwheel="true" control_position="left"]

If you need the location ID, go to the ‘All Stores’ page under the ‘Store Locator’ menu item. Hover your mouse over the title of the location you need the ID from, and look in the bottom left corner of your screen.

You will see a URL that includes post=xxxx. The xxxx is the post ID that you can use in the shortcode.