Skip to content

Instantly share code, notes, and snippets.

<?php
$asl_wc_states =
["CZ" => ["20A" => "Praha-z\u00e1pad","20B" => "P\u0159\u00edbram","20C" => "Rakovn\u00edk"],"FR" => ["20R" => "Corse","2A" => "Corse-du-Sud","2B" => "Haute-Corse","69M" => "M\u00e9tropole de Lyon","6AE" => "Alsace","75C" => "Paris","ARA" => "Auvergne-Rh\u00f4ne-Alpes","BFC" => "Bourgogne-Franche-Comt\u00e9","BL" => "Saint-Barth\u00e9lemy","BRE" => "Bretagne","CP" => "Clipperton","CVL" => "Centre-Val de Loire","GES" => "Grand-Est","HDF" => "Hauts-de-France","IDF" => "\u00cele-de-France","MF" => "Saint-Martin","NAQ" => "Nouvelle-Aquitaine","NOR" => "Normandie","OCC" => "Occitanie","PAC" => "Provence-Alpes-C\u00f4te-d\u2019Azur","PDL" => "Pays-de-la-Loire","PF" => "French Polynesia","PM" => "Saint Pierre and Miquelon","TF" => "French Southern and Antarctic Lands","WF" => "Wallis and Futuna"],"AR" => ["A" => "Salta","B" => "Buenos Aires","C" => "Ciudad Aut\u00f3noma de Buenos Aires","D" => "San Luis\t","E" => "Entre R\u00edos","F" => "La Rioja","G" => "Santiago del Estero","H" => "Chaco"
List of shortcodes for additional dropdown filters.
# Brand only
[ASL_STORELOCATOR filter_ddl="brand"]
# Specialities only
[ASL_STORELOCATOR filter_ddl="special"]
In the Google Console, to restrict the Google Maps API Key we need to create referrer lines, for website that has www at the start of the URL need to have 4 referrer lines such as follows:
your-domain.net
your-domain.net/*
*.your-domain.net
*.your-domain.net/*
Note: In the video, only two referrer URL as defined which will not work for the URLs having www at the start
Steps to create detail page with SEO friendly URLs.
1- Copy the code into functions.php (make sure to replace 1970 with the correct page id of your store detail page)
// Pretty URL for the Store Locator
add_action( 'init', function() {
add_rewrite_rule('^stores/?([^/]*)/?','index.php?page_id=1970&sl-store=$matches[1]','top');
});
## To add the WhatsApp number link in the Store Locator listing, please copy the HTML code and paste in the listing template, make sure to copy the correct template code (Template 3 has different HTML)
Please make sure to add the custom field whatsapp in the ASL Settings.
Video link for the customization tutorial
=========================================
https://www.youtube.com/watch?v=t_dGkPCGcMQ
For the List Button
====================
## To add the Rating stars in the Store Locator listing, please copy the HTML code and paste in the listing template, make sure to copy the correct template code (Template 3 has different HTML)
Please make sure to add the custom field rating in the ASL Settings.
For Template 0, 1 and 2
-----------------------
<p>{{stars rating}}{{/stars}}</p>
For Template 3
--------------
@agilelogix
agilelogix / gist:c1dce7c4fe1eb0b84604ff53f9a256b0
Last active September 22, 2023 23:01
Store Locator WordPress Customization
1- Social Media Links
---------------------
<div class="sl-row">
<div class="pol justify-content-center text-center">
{{if facebook_url}}
<a target="_blank" href="{{:facebook_url}}" class="btn btn-asl">Facebook</a>
{{/if}}
{{if twitter_url}}
<a target="_blank" href="{{:twitter_url}}" class="btn btn-asl">Twitter</a>
{{/if}}
Social Media Icons
-------------------------------
<div class="sl-row mt-2">
<div class="pol justify-content-center text-center">
{{if facebook_url}}
<a href="{{:facebook_url}}" class="btn btn-asl">[Facebook]</a>
{{/if}}
{{if twitter_url}}
<a href="{{:twitter_url}}" class="btn btn-asl">[Twitter]</a>
{{/if}}