| 开发者 | tijmensmit |
|---|---|
| 更新时间 | 2026年12月1日 18:15 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv3 or later |
| 版权网址: | 版权信息 |
👉 Try the live demo · DocumentationThe map starts at the world, or at your country when all your stores are in one. Every country and state is shaded by how many stores it has. Click a country to see its states, and click a state to see its stores below the map, with their address and a link to the store page. What you get
[wpsl_region_map].assets/flags/LICENSE.md.
Sample stores: names and addresses from Wikidata, public domain (CC0), see sample/LICENSE.txt.
See data/1/2026.1/LICENSE-DATA.txt in the plugin folder, and license.txt for the licences of everything the plugin includes.
Source code
Nothing in the plugin is minified except the block's editor script, assets/dist/blocks/region-map/index.js. Its source is assets/src/blocks/region-map/index.js in the plugin folder; npm install and npm run build (see package.json) build it with @wordpress/scripts.
[wpsl_region_map] shortcode.region="US" starts the map at a country, at a state such as US-CA, or at world. Without it, the map starts at the country of your stores, or at the world when they are in more than one.region="europe" starts the map at a continent: europe, africa, asia, north-america, south-america or oceania. region="eu" shows the 27 countries of the European Union. The map shows only those countries and stays inside them. A country that lies on two continents, like Russia or Turkey, shows only the part on that continent, and counts the stores of its states on that side: Istanbul's stores are in Europe, Ankara's in Asia.category="shops,outlets" shows only the stores in these store categories (their slugs).empty="hide" hides the regions without stores, instead of showing them muted.labels="hide" leaves the store counts off the regions. By default each region with stores shows its count: on a country's map a small state gets a smaller number, while on a continent map a country too small for its number shows it on hover and focus. The world map shows no counts, as only its largest countries would have room for one. Without the attribute the map follows the "Store counts on the map" setting.height="400" caps this map's height in pixels, from 200 to 1200; a wide map gets narrower to stay within it. Without it the map follows the "Maximum height of the map" setting.flags="hide" leaves out the country flags before the country names in the lists, the breadcrumb and the heading. Without it the map follows the "Country flags" setting.shading="gradient" gives every store count its own shade, from the lightest to the region color, instead of five steps. Without it the map follows the Shading setting.template="simple" shows each store with its name, address and a link. The default, detailed, adds the phone number, email address and Directions and Website buttons.icons="false" leaves out the icons in the detailed cards. Without it they follow "Use icons?" in WP Store Locator's Appearance settings; icons="true" always shows them.Yes. Tick "Create region pages?" under Store Locator › Region Maps › Settings › Region pages, and pick the page with your map. Every level of that map then has a clean address below the page, such as /stores/australia/new-south-wales/, with the region's name in the page title, its own canonical link (also with Yoast SEO and Rank Math), and a place in WordPress's sitemap. A map that starts at one country starts its addresses at the state: /us-stores/california/. Old links with ?wpsl_region= move to the new address. It needs pretty permalinks; maps on other pages keep their ?wpsl_region= links.
Yes. Each map keeps its own level, also in the URL.
Store Locator › Region Maps lists every store without a region and why: it has no coordinates, or its coordinates are outside every country. Fix the coordinates in the store's settings and it is tagged again by itself.
Under Store Locator › Region Maps › Settings. Themes can also set --wpsl-region-1 to --wpsl-region-5, --wpsl-region-empty, --wpsl-region-active and --wpsl-region-active-border on .wpsl-region-map.
Yes, under Store Locator › Region Maps › Settings: the map is at most 600 px tall by default, centred above the stores. It keeps its shape, so lowering the height makes a wide map narrower too, and a tall map like Chile gets a narrow box. Otherwise it is as wide as the page's content column. Themes can change the height with --wpsl-region-map-height and cap the width with --wpsl-region-map-width, for example .wpsl-region-map { --wpsl-region-map-width: 640px; }.
The plugin loads its stylesheet in the page head when the page's content has the block or the shortcode. A map printed by a theme template, a page builder or a widget loads it later, and some plugins drop late stylesheets. Tell the plugin which pages have a map:
add_filter( 'wpsl_region_maps_needs_assets', function ( $needed ) { return $needed || is_page( 'stores' ); } );
Yes. Under Store Locator › Region Maps › Settings › Sample data, add 500 museums, libraries, theatres and universities on every continent, with categories, phone numbers and opening hours. Their names and addresses are real, from Wikidata; the phone numbers and opening hours are made up. The same screen removes exactly these again, and uninstalling the plugin removes them too. A sample store you give another name or address becomes your own store and stays.