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

Class

This attribute augments the tag attribute specified below.

Adds the specified CSS class to the HTML tag that wraps the output.

This will output the website link as a hyperlink wrapped in an H4 HTML tag with the specified class added to the tag , but only if the URL field is set for the location.

<h4 class=”col-xs-12″><a href=”http://www.storelocatorplus.com”>www.storelocatorplus.com</a></h4>

Field

The field attribute is used to output location data fields from the current active location linked to the page.   The field names should be the field slug.  They slug is not case sensitive.    By default a slug is the field name in lowercase with no spaces.

This will also set the field name used for some of the other attributes.   Thus is is important to list this first if using some attributes such as the “type” attribute.

Outputs the name of the location.

Hard Coded Value

This attribute outputs the value of the hard_coded_value setting back to the page.

Output A value goes here.  Mainly used by add on packs to man-handled Store Pages output.

Map

The map attribute will output a self-contained Google Map showing the location.  The map is generating using the standard div and JavaScript driver model not an iframe.   The location must have valid latitude and longitude settings (be geocoded).    Other plugins and themes that include Google Maps but do not follow best practices for implementation may prevent pages maps from rendering.

Show  a map that centers on the location with a map marker for the location lat/long.

Tag

This attribute will wrap the output within the given tag if there is output to be rendered.

This will output the store name wrapped in an H4 tag.

This will output the website link as a hyperlink wrapped in an H4 HTML tag , but only if the URL field is set for the location.

<h4><a href=”http://www.storelocatorplus.com”>www.storelocatorplus.com</a></h4>

Title

This attribute sets the title for the page to the specified string. Used for WordPress generated bullet lists of custom page types.

Output My New Title at the top of any WordPress generated bullet list or formatted page list.

Type

This attribute applies special formatting to a field specified with the field attribute.   The field attribute should be listed first then the type attribute.

The following settings can be used with the type attribute:

Type Attribute, Data

This is the default type when the field attribute has been used.  Does not need to be specified.

This will output the store name.

Type Attribute, Hyperlink

Use the hyperlink type to wrap the field in a clickable hyperlink.

[storepage field=url type=hyperlink] will output a clickable hyperlink of the store URL (web page) if it is set.

You can change the text shown to be different than the link itself with the Title attribute:

[storepage field=”page_url” title=”Visit Store Page” type=”hyperlink”] to make a clickable link to the Store Pages url with a text label “Visit Store Page”.

Type Attribute, Image

Use the image type to use the store field as the source of an image.  Needs to be a fully qualified URL.

[storepage field=image type=image] will output the image URL as a displayed image on the page.

Type Attribute, Mailto

Use the mailto type setting to create a clickable mailto: hyperlink that will open the browser’s default email application with to set to the value of the field.

[storepage field=email type=mailto] will create a mailto link to send email to the email address set for the location.

Post

The Post attribute is used to output the WordPress Post object member variable within the page.   These fields include the standard WordPress page type settings that are attached to all pages including the Store Locator Plus store_page custom page types.

Member Variables of WP_Post as of WordPress Version 3.5.1

Member VariableVariable TypeNotes
IDintThe ID of the post
post_authorstringThe post author’s user ID (numeric string)
post_namestringThe post’s slug
post_typestringSee Post Types
post_titlestringThe title of the post
post_datestringFormat: 0000-00-00 00:00:00
post_date_gmtstringFormat: 0000-00-00 00:00:00
post_contentstringThe full content of the post
post_excerptstringUser-defined post excerpt
post_statusstringSee get_post_status for values
comment_statusstringReturns: { open, closed }
ping_statusstringReturns: { open, closed }
post_passwordstringReturns empty string if no password
post_parentintParent Post ID (default 0)
post_modifiedstringFormat: 0000-00-00 00:00:00
post_modified_gmtstringFormat: 0000-00-00 00:00:00
comment_countstringNumber of comments on post (numeric string)
menu_orderstringOrder value as set through page-attribute when enabled (numeric string. Defaults to 0)

[storepage post=post_title]  will output the WordPress title for the page, usually the same as the location name but can be manually edited after the page was created to read something else.

Post Attribute, post_content Value

The post=post_content setting is a special case.   When [storepage post=post_content] is used, the content is assumed to have storepage shortcodes.    Any post=post_content settings within the page are stripped and the content is itself the parsed for storepage shortcodes.

Post Attribute, permalink Value

The post=post_content setting is a Store Locator Plus extension to the post data.  It will output the permalink for the current post.