Results Layout Shortcodes and Attributes

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.

Curly Quotes In WordPress Shortcodes

WordPress blog posts likes to use curly quotes instead of straight quotes whenever you write an article.     Our documentation site is built on WordPress which means many of our articles are replaced any quotes we type in an article with curly quotes.

The problem is that the WordPress shortcode processor does NOT like curly quotes.   If you use curly quotes in a shortcode attribute such as [slp_directory by=”city”] and those quotes are “curly”, WordPress treats the quotes as a plain-old alphabetic character just like the C-I-T or Y in “city”.   In other words WordPress things you mean “by quote-city-quote” not “by city”.

Why is that an issue?

If you copy-and-paste most examples from this documentation site WordPress will copy the “pretty curly quotes” into your shortcode.     If you paste that into your WordPress page it breaks.

Straight versus curly quotes when pasted into a page.

An example of how this can impact Store Locator Plus can be seen from my example where I pasted the slp_directory shortcode directly from the docs site into my test site.    I get an invalid data query because WordPress added curly-quotes to my data field name.    The SLP database does not have a field name quotesl_storequote but does have a field named sl_store.

The fix?

Make sure you re-type each quote manually.  Typing the ” in your blog instead of copy-and-paste will ensure you are getting “straight quotes” in your shortcode attributes not curly quotes.

This is how the example looks now that the curly quotes have been replaced with straight quotes.

Q. What is the difference between a shortcode and locator layout settings?

A.    A shortcode is a WordPress-specific code that lets you do nifty things with very little effort.  Shortcodes can embed files or create objects that would normally require lots of complicated, ugly code in just one line.   In other words, a Shortcode = shortcut.

Directory City/State/Country Filters

The directory feature of the Power add on allows you to quickly build a directory-style listing on your pages to show a list of cities, states, or countries where you have locations.

The [slp_directory] shortcode used to build this listing can be combined with a landing_page attribute to quickly refer your site visitors to an interactive map showing your locations in the selected city, state, or country.

Additional Layout Shortcodes with Power Add-on

If you have the Power Add-on in addition to the Experience Add-on you have additional fields that can be displayed with the use of shortcodes and attributes.

Contact Fields

The Power Add-on has Contact Fields that can be associated with your locations for adding internal special  ids  for updates or to add filters. The contact fields will not automatically appear in your results on the front end.

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.

Note: As of  WordPress Plugin API update 4.2.3 effects shortcodes with filtered styles which will not be recognized when stored between quotes.

The Store Page [storepage] Shortcode

The [storepage] shortcode is used by the Pages and Power add ons to render live location data on a location (store) page.     The template is set under the Pages / Settings tab in the Initial Page Features group via the Page Template setting.

The [storepage] Shortcode

By default the [storepage] shortcode does not output any content.   You need to use one of the following attributes to generate location-specific output.

Attributes

  • class – augments the tag attribute with the specified CSS class
  • field – specify which location field to display
  • hard_coded_value – output the text in the wrapper
  • map – show a map with the location marker
  • post – output the WordPress post attributes for the page
  • tag – wrap the output with the specified HTML tag
  • title – output a title for list of pages
  • type – specify the type (style) for the output

Additional Search Layout Shortcodes and Attributes

You must have the Experience Add-on   to change the Search Layout appearance, and along with other add-ons,  also allow you to to use the shortcode on  SLP WP page.

These  shortcodes only apply to the Search Layout admin setting when you have the appropriate  Add-on installed and activated.

slp_search_element

This shortcode provides a simple mechanism to place standard search form elements on a custom search form layout, including the wrapping divs and classes around labels and input fields.

button Attribute

Places a search form button on the search form.