Changing the results layout is a feature provided for Professional level accounts. Users of the self-managed WordPress plugins will find this 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  Settings/Results/Appearance and saving the settings.

 

 

 

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 add-on for the WP Store Locator Plus Plug-in (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’.

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]

Display the 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 zip_state_city]

The zip followed by the state followed by the city with European-style formatting.  A space is inserted between each element.

[slp_location country]

Display the 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]

Display the location ID field.

[slp_location data.sl_private]

Display whether or not the location is 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.

ifnotset=”<fieldname>”

Inverse of ifset as noted above.

If the specified location data field is NOT empty…

Examples

The example shows the location’s phone number as long as the phone field is set. Only if the phone field is NOT set will it show the fax.

The [slp_location phone] field can be modified with other settings like add dial extension. The use of data.sl_phone, instead of simply phone, allows us to query the original location data.

[slp_location phone ifset="data.sl_phone"]
[slp_location fax ifnotset="data.sl_phone"]

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.

Default Setting for Results Layout

The default setting for the Results Layout (Smart Option ID: resultslayout) as of January 2023 is shown below:

<div id="slp_results_[slp_location id]" class="results_entry location_primary [slp_location featured]">
    <div class="results_row_left_column"   id="slp_left_cell_[slp_location id]"   >
        <span class="location_name">[slp_location name] [slp_location uml_buttons] [slp_location gfi_buttons]</span>
        <span class="location_distance">[slp_location distance_1] [slp_location distance_unit]</span>
    </div>
    <div class="results_row_center_column location_secondary" id="slp_center_cell_[slp_location id]" >
        <span class="slp_result_address slp_result_street">[slp_location address]</span>
        <span class="slp_result_address slp_result_street2">[slp_location address2]</span>
        <span class="slp_result_address slp_result_citystatezip">[slp_location city_state_zip]</span>
        <span class="slp_result_address slp_result_country">[slp_location country]</span>
        <span class="slp_result_address slp_result_phone">[slp_location phone_with_label]</span>
        <span class="slp_result_address slp_result_fax">[slp_location fax]</span>
    </div>
    <div class="results_row_right_column location_tertiary"  id="slp_right_cell_[slp_location id]"  >
        <span class="slp_result_contact slp_result_website">[slp_location web_link]</span>
        <span class="slp_result_contact slp_result_email">[slp_location email_link]</span>
        <span class="slp_result_contact slp_result_directions"><a href="https://[slp_option map_domain]/maps?saddr=[slp_location search_address]&daddr=[slp_location location_address]" target="_blank" class="storelocatorlink">[slp_location directions_text]</a></span>
        <span class="slp_result_contact slp_result_hours">[slp_location hours]</span>
        [slp_location pro_tags]
        [slp_location iconarray wrap="fullspan"]
    </div>
</div>

NOTE
Category icons or markers can be displayed on the map or in the result  but if you need to re-iterate and show the category text, you will need to add tags to locations and add the sl_tag  under the results layout. 

Resetting To Default

This setting is included in the Default Locator Layout style.

To reset to this setting — NOTE: this will overwrite most of your locator settings.

  • Login to your SLP account
  • Go to Settings | View
  • In the Appearance section find the “Default” locator style.
  • Click Select (or Reload if the button says Reload)

post image via Pixabay