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.

The Field Attribute

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.

[storepage field=store] will output the name of the location.

The Hard Coded Value Attribute

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

[storepage hard_coded_value=”A value goes here”] will output A value goes here.  Mainly used by add on packs to man-handled Store Pages output.

The Map Attribute

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.

[storepage map=location] will show  a map that centers on the location with a map marker for the location lat/long.

The Title Attribute

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

[storepage title=”My New Title”] will output My New Title at the top of any WordPress generated bullet list or formatted page list.

The Type Attribute

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:

The Hyperlink Type Setting

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.

The Image Type Setting

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.

The Mailto Type Setting

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.

The Post Attribute

Available in version 4.5 of the Power add on.

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 Variable Variable Type Notes
ID int The ID of the post
post_author string The post author’s user ID (numeric string)
post_name string The post’s slug
post_type string See Post Types
post_title string The title of the post
post_date string Format: 0000-00-00 00:00:00
post_date_gmt string Format: 0000-00-00 00:00:00
post_content string The full content of the post
post_excerpt string User-defined post excerpt
post_status string See get_post_status for values
comment_status string Returns: { open, closed }
ping_status string Returns: { open, closed }
post_password string Returns empty string if no password
post_parent int Parent Post ID (default 0)
post_modified string Format: 0000-00-00 00:00:00
post_modified_gmt string Format: 0000-00-00 00:00:00
comment_count string Number of comments on post (numeric string)
menu_order string Order 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.