Shortcodes

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

Store Locator

The [wpsl] shortcode options:

  • template The id of the template you want to use. The default template ids that are available are “default” and “below_map”, but you can add additional templates with the wpsl_templates filter.
  • start_location The location where the start marker is placed. If no location is set the default start location from the settings page is used.
  • category This will restrict the search results to the provided category slug(s). Using this will hide the dropdown / checkbox filters since the results are automatically filtered in the background.
  • category_filter_type dropdown/checkboxes. If no value is provided, then it will default to the filter settings from the WPSL settings page.
  • category_selection This enables you to set a selected category. If you’re using a dropdown then you can only provide a single category slug, but if you’re using checkboxes, then you can provide multiple category slugs.
  • checkbox_columns If the filter type is set to checkboxes, then you can use this to define the number of used columns. You can set it between 1 and 4. If no value is provided, then it will default to 3 columns.
  • auto_locate true/false. Whether or not to try to and determine the users current location by using the Geolocation API. Defaults to the value from the WPSL settings page.
  • map_type roadmap/satellite/hybrid/terrain. Set the used Google Maps Map Types. If no value is provided, then it will default the map type set on the WPSL settings page.
  • start_marker blue/dark-blue/green/dark-green/orange/dark-orange/pink/purple/red, or the name of your custom marker. Defaults to the selected start marker on the WPSL settings page.
  • store_marker blue/dark-blue/green/dark-green/orange/dark-orange/pink/purple/red, or the name of your custom marker. Defaults to the selected store marker on the WPSL settings page.

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 porche category selected. It also uses a blue marker as the start marker, and a green marker as the store marker.

[wpsl template="default" category_type="checkboxes" category_selection="bmw,mercedes,porche"
start_location="times square,new york" start_marker="blue" store_marker="green"]
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 store address shortcode will show the address details together with the contact details.

The [wpsl_address] shortcode options:

  • id The id of the store you want to show the address for. This is only required if you use this shortcode on a page that isn’t a store location page.
  • name true/false. Whether to show the name. Defaults to true.
  • address true/false. Whether to show the address. Defaults to true.
  • address2 true/false. Whether to show the second address. Defaults to true.
  • city true/false. Whether to show the city. Defaults to true.
  • state true/false. Whether to show the state. Defaults to true.
  • zip true/false. Whether to show the zip. Defaults to true.
  • country true/false. Whether to show the country. Defaults to true.
  • phone true/false. Whether to show the phone. Defaults to true.
  • fax true/false. Whether to show the fax. Defaults to true.
  • email true/false. Whether to show the email. Defaults to true.
  • url true/false. Whether to show the url. Defaults to true.
  • directions true/false. Whether to show a directions link that takes the user to Google Maps. Defaults to false.
  • clickable_contact_details true/false. Whether to make the phone and email details clickable. Defaults to the value from the settings page.

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 options:

  • id The id of the store that you want to show the opening hours for. This is only required if you use this shortcode on a page that isn’t a store location page.
  • hide_closed true/false. Whether to hide the closed hours. Defaults to false.

Example:

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

Store Map

This shortcode shows the provided store(s) on the map, but without a search option.

The [wpsl_map] shortcode options:

  • id The id of the store(s) you want to show on the map. This is only required if you use this shortcode on a page that isn’t a store location page, or if you want to show multiple stores.
  • category This will restrict the shown locations to the provided category slug(s).
  • width The width of the map in pixels. Defaults to 100%.
  • height The height of the map in pixels. Defaults to the height from the settings page.
  • zoom The zoom level of the map. The number has to be between 1 and 21. Defaults to the zoom level from the settings page. If the category options is also used, then the zoom level is automatically adjusted to make all the markers fit on the map, so the set zoom level is ignored.
  • map_type Set the map type. Allowed values are roadmap, satellite, hybrid and terrain. Defaults to the map type from the settings page.
  • map_type_control true/false. Whether or not to show the map type controls. Defaults to the map type control setting from the settings page.
  • map_style Can only be set to “default”. If left out, and a custom map style is provided on the settings page under “Map style”, then the custom map style will be used. Setting it to default will ignore the custom map style.
  • street_view true/false. Whether or not to show the option to enable street view. Defaults to the street view setting from the settings page.
  • scrollwheel true/false. Whether or not to disable scrollwheel zooming. Defaults to the scrollwheel zooming setting from the settings page.
  • control_position left/right. Set the position of the map controls. Defaults to the map control setting from the settings page.

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, then you can find this by going 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 take a look in the bottom left corner of your screen.

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