After activating the Cardinal Store Locator plugin and entering your license key, you’ll be able to view and update any of the plugin settings. Don’t be overwhelmed by the number of settings that are available. You actually don’t have to set any of them to get the plugin functioning assuming you want to use the built-in locations custom post type to add your locations.
The primary setting you need to focus on initially is “Data source” setting under the Primary Settings tab:
- Register Locations Post Type: If you plan on manually adding locations one by one, leave this setting set to “Register Locations Post Type” and begin adding locations via the new “Locations” link in the left column of the WordPress dashboard. It’s important to note that if you’re using this method, you need to be connected to the internet when adding new locations so API connections for geocoding the address don’t fail.
- Other Custom Post Type: If you’ve already set up a locations custom post type and have added custom meta fields for addresses (through Advanced Custom Fields or other methods) choose this option. After saving an additional “Address Meta Field Mapping” tab will appear that will allow you to map your meta fields so the plugin can pull the appropriate data. Note, that if your locations haven’t already been geocoded with latitudes and longitudes, you will need to update the posts. A scheduled geocoding task may be added to the plugin in a future version.
- Local File: If you have an existing locations dataset and don’t want to import/add the locations in WordPress, the plugin is able to read KML, XML and JSON files. However, there are some important notes to make when using this option. If using XML or JSON in the current version of the plugin, attribute names need to match what the underlying jQuery plugin is looking for. Please see the XML formatting and JSON formatting examples on how to structure the data. If enough requests are received attribute mapping settings may be added in the future. The other important thing to note with the Local File option is that all locations need to be geocoded with latitude and longitudes (lat and lng attributes) for the locations to show up on the map.
- Remote URL: If you have an existing dataset and it needs to be hosted on or pulled from another server, the plugin is able to read KML, XML or JSON data. Please read the “Local File” bullet above on file structure and geocoding as it also applies if using this Remote option. In addition, please be aware that you can run into cross-origin issues with this setting and may need to enable CORS on the server.
Countries and region biasing
If all of your locations are in a specific country, especially when outside of the US, you may need to take advantage of the plugin’s filter to modify the Google Maps URL to add an additional region query string parameter. For example, if all of your locations are in the United Kingdom you would add something such as the following in your theme’s functions.php or other appropriate included PHP file:
If you have locations in multiple countries it is highly recommended to ensure that the ccTLD two letter country code is set in the location data and to set “Region” to true under the “Structure Settings” tab in the plugin settings. After enabling that setting, a “Region values” textarea field will appear where you can add all of the possible country values that visitors can choose from on the front-end form.