Results Layout Shortcodes and Attributes

The ability to change results layout is included in the Experience add on.

Default Format

The default format for the results string uses the numerical encoding for the various data elements that can be rendered.   This default string format is present in the base Store Locator Plus plugin.  You can reset  to the default at any time by deleting the entry in the Results Layout field under Experience/Results/Appearance and saving the settings.

Results layout section 4.4. exp

Shortcodes

The Results Layout is a combination of HTML and special shortcodes that are only active when rendering locations.  These strings can be reordered or deleted if you have the Experience add on.  Display a specific location field, such as a store name, or a location data element, such as  distance,  where you want it to  appear in the results layout.   Location fields are data taken directly from the location data table.

You can output a single field (using the correct data field name as shown under Location  import) with the [slp_location <location_data>] shortcode in the results layout.

[slp_location <field name>]

Display data for a single location. Field name is a location field name.

It can be a primary field name such as ‘name’.

Primary Field Names as of 4.7.4 (Mar 10 2017)

It can be a Secondary Field Name, as indicated with the “dot notation” which allows access to the “Object” Primary Fields such as “data”.    This is typically where add on and extended fields live as well as full access to the raw data for the base plugin.   For example the field “data.sl_id” will output the location ID.

Examples:

[slp_location address]

[slp_location address2]

[slp_location city]

[slp_location city_state_zip]

The city followed by the state followed by the zip with USA-style formatting.   If the city and state are not blank a comma is inserted between the two.   The zip is at the end with a space before it if either city or state are not blank.

[slp_location country]

[slp_location email]

Display the email.  This is not clickable just the raw email.  You will likely want to use email_link from the Experience add-on instead.

[slp_location hours]

The raw hours text, not HTML sanitized.

[slp_location hours_sanitized]

The hours text field with all special characters decoded using JavaScript text formatting.

[slp_location url]

Display the url.  This is not clickable just the raw url.  You will likely want to use web_link or url_link instead.

[slp_location url_link]

Display the url in a clickable link.  Displays the full URL instead of the website label.  Use web_link if you prefer the website label.  The website label can be changed with the Experience add-on.

[slp_location web_link]

This will be the location URL from the location database OR a link to the  Pages web page if “pages replace website” is enabled in  Pages.   The text will be the website label text.

[slp_location data.sl_id]

[slp_location data.sl_private]


[slp_option <option_name>]

Display the value of a setting, typically from the base Store Locator Plus setting to output a label or other text element set in the global settings.

Some of the slp_option settings that come with the base plugin. Add ons can , and often to, modify the settings that can be used with the [slp_option …] shortcode in results layout.

[html br|closing_anchor]

Display an HTML string.

Allows for a <br> tag or closing anchor tag </a> to be output based on conditions.

Examples

[html br]

[html closing_anchor]


[slp_addon …]

A placeholder marker for indicating to add ons where special processing is to take place.  Has not output.


Modifiers

These modifiers apply to ALL of the results layout settings other than [slp_addon …].

[slp_location <fieldname>] , [slp_option <option_name>], and [html br|closing_anchor] can all use these as the third parameter.  The “text” will be the field value, setting value, or HTML <br/> or </a> tag.

ifset <fieldname>

If the specified location data field is empty or evaluates to false as a JavaScript expression then NOTHING will be output.   Otherwise output the text.  Useful for turning off specific output when a field is blank.

suffix

Output the noted suffix after the text string.

br

Output the HTML break <br/>

comma

Output a comma ,

comma_space

Output a comma followed by a space ,

space

Output a space

wrap

Wrap the text with some special HTML code.

directions

An HTML anchor tag linked to the Google Maps directions format with source address being what the user typed in the search box and destination being the location’s full address.   Make the text for the given field the ‘clickable part’.

img

Use the text as the image source in an HTML <img src… /> tag.

mailto

Use the text as the email address in an HTML <a href=”mailto…” tag.   Does NOT output the closing part of the tag.   Use [html closinganchor] to set this.

website

Use the text as the website URL in an HTML <a href=”…” tag.  Does NOT output the closing part of the tag.   Use [html closinganchor] to set this.

fullspan

Add a <span class=”results_line location_<field|option name>”>…</span> HTML string around the text.

format

Apply a special format to the text.   Must be ‘decimal1‘ , ‘decimal2‘ , ‘sanitize‘, or ‘text‘.

decimal1

Parse the text as a float and show one digit after the decimal.

decimal2

Parse the text as a float and show two digits after the decimal.

sanitize

Strip out anything that is not a “word character” (letters, numbers, underscores, hyphens).

text

Force the data to be passed trough the  HTML parser and convert special HTML characters to their ampersand encoding.

raw

Normally any text string will be run through the JavaScript HTML parser to encode special characters such as < to &lt;.   The raw modifier will force the original string to be output as-is.  Useful it trying to output an HTML setting intact.

 

Additional Location Data

The Power and Extended Data Manager add ons allow additional fields to be added to locations.   They can be output using the [slp_location data.<slug>] shortcode.

Read the related results layout documentation pages for details.

Add Ons That Support This Feature

Buy the Experience Add On
Buy the Experience Add On