Available template variables

Cardinal uses Handlebars to render the location list items beside the map and the info window that opens when a marker is selected. Override either template from your theme and use the variables below.

Overriding the templates

The plugin looks for a cardinal-locator directory in your active theme. Copy either file there and edit it.

  1. Copy from /wp-content/plugins/cardinal-locator/public/assets/templates/
  2. Paste into /wp-content/themes/your-theme/cardinal-locator/

Seeing odd special characters? Use the triple-stash expression {{{variable}}} instead of double brackets to output unescaped HTML.

Variables

VariableDescription
{{id}}Location post ID
{{name}}Location post title
{{permalink}}Permalink to the location post
{{excerpt}}Location post excerpt
{{lat}}Location latitude
{{lng}}Location longitude
{{featuredimage}}URL of the location post featured image
{{address}}Street address meta value
{{address2}}Secondary address meta value
{{city}}City meta value
{{state}}State meta value
{{postal}}Postal code meta value
{{country}}Country meta value
{{email}}Email meta value
{{phone}}Phone meta value
{{fax}}Fax meta value
{{web}}Web meta value
{{hours1}}Hours 1 meta value
{{hours2}}Hours 2 meta value
{{hours3}}Hours 3 meta value
{{hours4}}Hours 4 meta value
{{hours5}}Hours 5 meta value
{{hours6}}Hours 6 meta value
{{hours7}}Hours 7 meta value
{{featured}}Featured location meta value (only with default CPT)
{{bh_sl_loc_cat}}Comma separated list of selected location categories (only with default CPT)
{{bh_sl_loc_cat_terms}}Array of selected term objects (only with default CPT)

Custom fields & taxonomies

Any custom meta field on the locations post type is available by its field name. Custom taxonomies are available two ways:

{{your_meta_field}}        // custom meta field value
{{your_taxonomy}}          // comma-separated term names
{{your_taxonomy_terms}}    // array of term objects

To send additional data to the templates, or change any value above, use the location data filter.

Last updated

· Suggest an edit