Shortcodes for StoreLocatorPlus and Add-ons

[slplus] is the primary shortcode used within WordPress sites to display the Store Locator Plus map and location search interface. Many other attributes can be found within the plugin and add-ons.

A shortcode is a special label inside of square brackets that is used within WordPress pages and posts to display the output from a plugin. You place a shortcode within the text of your page or post and the plugin will “do it’s magic”.

Note: Shortcode attributes WILL NOT WORK if Force Load JavaScript is turned on under Store Locator Plus General Settings. Try turning it off before using attributes. If Store Locator Plus won’t load when you turn Force Load JavaScript off, get a different WordPress Theme that fully implements WordPress code standards.

Locator Shortcode

To display the Store Locator Plus search form, map, and search results using the defaults you have setup via Map Settings in the admin panel, use the following shortcode:

1

[SLPLUS]

The base plugin will replace the shortcode with a search form, a Google Map, and a results section below the map. Depending on how you have the plugin configured the map and results may start by showing some or all of your locations.

Extended Attributes

You can use the following settings to modify how the store locator interface is displayed on the page.

allow_addy_in_url

center_map_at

Overrides the address where the map will be centered. This attribute will only work if Force Load JavaScript is disabled. Turn this off on the Map Settings page in Store Locator Plus. If the map stops working when turning off Force Load JavaScript, your theme is not properly updated to work with WordPress and does not handle footer action hooks. Contact your theme author and ask them to add footer action hook process as noted in thewp_enqueue_scripts() section of the WordPress Codex.

Example

1

[SLPLUS center_map_at="Pasadena CA 91106"]

city

Set a city string for use with the hidden city input. This will force the search to use discrete mode filters and only return those results where the city matches the EXACT text entered here. Cities should include the city and state separated by a comma and space. For example: Charleston,SC.

Example

city_selector

Values

discrete – show a drop down menu that is used to filter searches to only return locations that EXACTLY MATCH the city the user picks on the drop down menu.

hidden – hide the city selector input

input – show a drop down menu that will automatically fill in the address search box with the state the user picks on the menu, allowing the user to further modify the address such as adding a street to the city. This is used when you want to give the users some hint as to where your locations are but still rely primarily on radius based search results.

Example

1

[SLPLUS city_selector="discrete"]

country

Set a country string for use with the hidden country input. This will force the search to use discrete mode filters and only return those results where the country matches the EXACT text entered here.

Example

country_selector

Determine which country selector interface is to be displayed on the map. Requires Experience Add On.

Values

This attribute can be set to:

discrete – show a drop down menu that is used to filter searches to only return locations that EXACTLY MATCH the country the user picks on the drop down menu.

hidden – hide the country selector input

input – show a drop down menu that will automatically fill in the address search box with the country the user picks on the menu, allowing the user to further modify the address such as adding a street to the country. This is used when you want to give the users some hint as to where your locations are but still rely primarily on radius based search results.

Example

1

[SLPLUS country_selector="discrete"]

endicon

This will override the Map Settings destination icons on a per-page basis. The URL can be relative to your WordPress site or a fully qualified URL. Requires Experience Add On.

hide_map

Show or hide the map on a per-shortcode basis. Note: As of Enhanced Map 4.3, a drop down selector when Enhanced Map is installed and current may be used instead: Show Map, Hide until Search, or Display Image until search. Requires Experience Add On.

Example

1

[SLPLUS hide_map="true"]

hide_search_form

Turn the search form on or off on a per-page basis. Themes and CSS settings that hide the search form will take precedence over this setting. This setting takes precedence over the Enhanced Search “hide search form” checkbox. Requires Experience Add On.

Examples

1

2

[SLPLUS hide_search_form="true"]

[SLPLUS hide_search_form="false"]

homeicon

This will override the Map Settings home icon on a per-page basis. The URL can be relative to your WordPress site or a fully qualified URL. Requires Experience Add On.

Radius

immediately_show_locations

Overrides the global immediately show locations setting on a per-page basis. When set to true the page will bring up locations based on the Center Map At and Radius To Search Initially settings. Requires Experience Add On.

Immediately Show Locations

Show locations within the default radius of the default map center.

1

[SLPLUS immediately_show_locations='true']

DO NOT Immediately Show Locations

The user must search for an address before locations are shown.

1

[SLPLUS immediately_show_locations='false']

initial_radius

Override the default initial radius used for immediately show locations mode.

Example

no_autozoom

Example

1

2

3

[SLPLUS no_autozoom="true"]

[SLPLUS no_autozoom="false"]

no_homeicon_at_start

Override the default No Home Icon At Start setting.

This determines whether or not to show the home icon from which all initial distances are calculated when first loading the map. The default is off since most users are not going to want to see where you’ve set the center of your map (default: center of the United States).

Example

1

2

3

[SLPLUS no_homeicon_at_start="true"]

[SLPLUS no_homeicon_at_start="false"]

only_with_category

When this shortcode option is provided the map will only display results that have been assigned the specified category. The only_with_category attributed must be set to the catgory slug. It is not case sensitive. Requires Power Add On.

Example

1

[SLPLUS only_with_category="adventure"]

only_with_tag

You can also force the search form to only return results that match a specific tag by using the ‘only_with_tag’ attribute. For this feature to work, you must have the tag input option turned on in map settings. This setting will override the default pulldown and the shortcode attribute “tags_for_pulldown”. Requires Power Add On.

Example

1

[SLPLUS only_with_tag="churches"]

order_by

Set the default results order, overriding ordering options set Globally. This is a feature for advanced users. This parameter Requires Experience Add On.required proper data field names to be used in the attribute values. If they are incorrect the search results may break. The value of this attribute should be the ORDER BY clause of a MySQL statement for the Store Locator Plus base and extended data tables. If you are not certain about the field names you can use a tool like the Database Peek plugin to view the *store_locator and *slp_extendo table structures to get the field names that are available.

Sort By Featured Locations At Top, Then Store Name

This will put all featured locations within the search radius at the top of the list sorted by store name followed by all non-featured stores in the radius sorted by store name.

1

[SLPLUS order_by="featured DESC, sl_store ASC"]

Defaults Distance Based Results

Sort all results by closest to furthest from the searched or map-center address.

1

[SLPLUS order_by="sl_distance ASC"]

results_box_title

The string for the results box title for Store Locator Plus styles in the Style Gallery that support it.

show_maptoggle

Example

1

[SLPLUS show_maptoggle="true"]

state

Set a state string for use with the hidden state input. This will force the search to use discrete mode filters and only return those results where the state matches the EXACT text entered here. Requires Experience Add On.

Example

1

[SLPLUS country_selector="hidden"state="SC"]

state_selector

Determine which state selector interface is to be displayed on the map. Requires Experience Add On.

Values

This attribute can be set to:

discrete – show a drop down menu that is used to filter searches to only return locations that EXACTLY MATCH the state the user picks on the drop down menu.

hidden – hide the state selector input

input – show a drop down menu that will automatically fill in the address search box with the state the user picks on the menu, allowing the user to further modify the address such as adding a street to the state. This is used when you want to give the users some hint as to where your locations are but still rely primarily on radius based search results.

Example

1

[SLPLUS state_selector="discrete"]

starting_image

The starting image is used when you have the Map Display set to “Image Until Search” which places an image where the map usually resides until a user enters and address and performs a search at which point the image goes away and the map appears.

To use a starting image to show in place of the map prior to a user search:

When you have a default starting image set but have one page where you want locations show immediately instead of the starting image you can remove it for one specific page:

1

[slplus starting_image=""]

tags_for_pulldown

You can override the default drop down list of tags (available with the Power add-on) on any page by using the tags_for_pulldown attribute on the shortcode. You specify each entry that you want to have appear on the drop down separated by commas. In order for the search results to return a value the tags will need to be entered exactly as they were input in the database when adding locations. Like the default pull down entries specified on the map settings page, you can specify the default by putting it in parenthesis. The custom pull down list will continue to honor the “include any” setting on the map settings page. If that option is checked off then your custom tag list will start with (any) that will match any entry in the database regardless of what tags are associated with the location. For this feature to work, you must have the tag input option turned on in map settings.

Example

append_to_search

When a user types in the search form address box, whatever text the site administrator adds (in quotes after the equal sign) will be appended to the search before it is sent to the map service.

center_map_at

1

[slplus center_map_at='Charleston SC 29401']

When this shortcode is used, it will set the default map center on your page in place of the global default in the Store Locator Plus admin panel. If no center map at address set under Settings/Map tab, the default is the center of the map domain you selected.

city

1

[slplus city='Charleston SC']

Limits the results to the specified city.

country

1

[slplus country='USA']

endicon

1

[slplus endicon="http://.../xyz.png"]

hide_map

1

[slplus hide_map='1']

Number 1 indicates the Hide the map command is on.

homeicon

1

[slplus homeicon="http://.../xyz.png"]

initial_results_returned

1

[slplus initial_results_returned='30']

map_center

1

[slplus map_center='Charleston SC 29401']

Alias for center_map_at.

map_region

1

[slplus map_region='bg']

Set this as the default region used to influence map searches. A 2-letter country code.

orderby

1

[slplus orderby='store']

1

[slplus order_by='store']

Sort location results by this location attribute.

show_maptoggle

1

[slplus show_maptoggle='1']

Show the map on/off switch on the user interface.

state

1

[slplus state='SC']

Limit results to this state.

Power

The Power add-on provides added functionality and features for large location lists, SEO management, and categorization of locations.

only_with_category

[slplus only_with_category=”orange”]

only_with_tag

[slplus only_with_tag=”red”]

tags_for_pulldown

[slplus tags_for_pulldown=”red,green,blue”]

tags_for_dropdown

[slplus tags_for_dropdown=”red,green,blue”]

Alias for tags_for_dropdown

Complete List

Store Locator Plus 4.9.7 was redesigned to allow all Smart Options to be set via the [slplus] shortcode attributes. Most are defined above, but there are some others that were previously unavailable. Some of the following attributes will require Power, Experience, or Premier add ons to function.