I’m happy to announce that WP Store Locator 2.2 has officially been released. It includes new features that make it easier to filter the search results by multiple categories and a significant number of other improvements.
Instead of showing the category list in a dropdown, you can now choose to show them in a checkbox list. This has the advantage that users are allowed to filter the search results by multiple categories at once.
The search field now optionally autocompletes the location searches.
Use custom HTML to create the “no results found” message
Instead of only showing the text from the “No results found” field on the settings page, you can now use the wpsl_no_results filter to create a custom HTML block informing the user the search results returned no results.
Automatically include values from custom dropdowns
If you’re using a custom dropdown filter in your template, then you had to modify the wpsl-gmap.js to make sure the data from the custom dropdown was included in the AJAX data.
From now on simply setting a “wpsl-custom-dropdown” class on the select element will make sure this happens automatically.
If you, for example, used this code in your template, select “Mercedes” and start the search, then the “mercedes” value is automatically included in the AJAX data under the “cars” key.
|wpsl_enable_styled_dropdowns||Define if the default
|wpsl_hide_closed_hours||Define if the days the location is closed are excluded from the opening hours list.|
|wpsl_map_tab_anchor_return||Change the used return value when the tab anchor is clicked.|
|wpsl_max_dropdown_height||Set the maximum allowed height for the dropdown filters. A scrollbar will appear if more space is required.|
|wpsl_no_results||Use this filter to show a custom HTML block instead of the default “No results found” text.|
- New: The option to show the contact details below the address.
- New: The option to hide the country name in the search results / marker pop-up.
- New: If you’re showing the category filters with checkboxes, then you can change a number of used columns by setting the “checkbox_columns” attribute ( between 1 and 4 ) on the [wpsl] shortcode.
- New: Added the “aria-required” attribute to the search field.
- New: You can now change the “Any” text used in the category dropdown in the labels section on the settings page.
- New: Added a Add-Ons page to the “Store Locator” menu.
- Changed: The category dropdown is now created with wp_dropdown_categories and correctly indents subcategories.
- Changed: If a search returns no results, then the map will now focus on the searched location instead of only showing the “No results found” msg.
- Changed: Instead of a single “API key” field, there are now separate server and browser key fields. If an API key existed, then it’s assumed to be a server key.
- Changed: A scrollbar is shown inside the styled dropdown filters if they are higher than 300px. You can change the maximum height with the wpsl_max_dropdown_height filter.
- Changed: Removed the text wrap on the category filter items. If a category name is too long, then it will now go over two lines instead of being cut off.
- Changed: Updated the wpml-config.xml and wpsl.pot.
- Changed: If the autocomplete for the start location on the settings page fails ( JS error ), then the set start location is geocoded in the background when the settings are saved.
- Changed: A single JS function now handles all the conditional options on the settings page instead of several smaller ones.
- Changed: The “zoom_name” and “zoom_latlng” setting is renamed to “start_name” and “start_latlng”.
- Changed: Renamed the “category_dropdown” setting to “category_filter” to better reflect the value that it holds (either checkbox or dropdown). So if you’re using a custom template, then make sure to change “category_dropdown” to “category_filter” in your code.
- Fixed: If you click on one of the styled dropdowns when it’s already open, then it will now close.
The Autocomplete Placeholder in a Custom Template
With the introduction of the autocomplete function, the search input field now by default has the placeholder attribute set. This is to prevent having the search input label set to “Your location”, and the placeholder set to “Enter a location” by the autocomplete script at the same time.
If you’re using a custom template, and are planning to use the autocomplete function, then you can prevent this from happening by adding
placeholder="" to the search input field in your custom template.
Open your template file and search for this:
Replace it with this code to prevent the input placeholder from being set to “Enter a location”:
You can install WP Store Locator 2.2 from your WordPress Dashboard, or download it directly from WordPress.org.