WP Multi Location Map
A WordPress plugin to display a map with multiple locations using a shortcode.
by Zaid Sameer · github.com/zaidsameer/wp-multi-location-map · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/zaidsameer/wp-multi-location-map/archive/refs/heads/main.zipWP Multi Location Map adds an intuitive map builder to the WordPress admin so you can publish interactive, Leaflet-powered maps with multiple locations, popups, and custom styles. Each map is stored as its own post type entry, letting you manage any number of maps independently and embed them anywhere with a shortcode.
Features
- Custom
Mapspost type with a live Leaflet preview inside the editor. - Add, drag, and remove unlimited markers by clicking on the preview map.
- Location fields for title, latitude/longitude, and rich popup descriptions.
- Global defaults for map center, zoom level, dimensions, language, and tile provider.
- Per-map overrides for center/zoom, dimensions, CSS classes, popup behavior, language, and tile provider (including custom tile URL + attribution).
- Built-in tile providers: OpenStreetMap, Stamen Toner, Stamen Watercolor, CARTO Light, CARTO Dark, plus custom templates.
- Optional right-to-left popup rendering to support Arabic and other RTL languages.
- Shortcode embeds by map ID or slug with automatic JSON payloads and Leaflet fallback handling.
- Migration helper that converts legacy single-map options into the new post type on first run.
- Translation-ready with a bundled POT file (
languages/wp-multi-location-map.pot).
Requirements
- WordPress 5.8 or later.
- PHP 7.4 or later.
- Internet access for Leaflet and the default tile providers (served via CDN).
Installation
- Download or clone the repository into
wp-content/plugins/wp-multi-location-map. - In the WordPress admin, go to Plugins → Installed Plugins and activate WP Multi Location Map.
- A new Maps menu will appear in the dashboard.
Tip: If you are packaging a ZIP for distribution, ensure the root folder inside the archive is
wp-multi-location-map/.
Quick Start
- Visit Maps → Add New.
- Provide a title for internal reference.
- Use the live preview to click and create markers. Drag markers to fine-tune their positions.
- Fill in the location name, latitude, longitude, and description for each marker.
- Adjust map options (center, zoom, dimensions, popups, language, tile provider, CSS classes) as needed.
- Publish the map and copy the shortcode from the “Map Shortcode” meta box.
- Paste the shortcode into any post, page, or block editor shortcode block.
Shortcode Reference
[wp_multi_location_map id="123"]
Attributes
id(int) – Load a specific map by post ID. Recommended.slug(string) – Alternative toid; resolves a map by post slug.
If neither attribute is supplied, the shortcode will fall back to the first published map or, when used on a map singular view, the current map.
Map Settings Overview
Each map edit screen provides two meta boxes:
-
Map Settings
- Default Center – Sets the map’s initial latitude/longitude.
- Default Zoom – Allows decimal zoom for precise framing.
- Show Popups by Default – Keep marker popups open on load.
- Additional CSS Classes – Space-separated classes added to the front-end container.
- Tile Provider – Choose a base layer or inherit the global default. Selecting Custom reveals URL and attribution fields.
- Map Dimensions – Width and height accept any CSS unit (e.g.
100%,600px). - Popup RTL – Wrap popup markup in RTL-friendly container markup.
- Language – Switch between English (
en) and Arabic (ar) tile variants.
-
Locations
- Add unlimited markers with name, latitude/longitude, and description fields.
- Reposition markers directly on the preview map.
- Remove markers via the inline delete button.
Global Defaults
Navigate to Maps → Settings to control new-map defaults and shared behavior:
- Default center and zoom applied to new maps.
- Default width/height for the map container.
- Default interface language (
enorar). - Default tile provider selection (with optional custom tile URL/attribution).
These values can be overridden per map but serve as sensible defaults for new entries.
Tile Providers & Custom Tiles
The plugin ships with predefined configurations for:
- OpenStreetMap Standard (
osm) - Stamen Toner (
stamen-toner) - Stamen Watercolor (
stamen-watercolor) - CARTO Light (
carto-light) - CARTO Dark (
carto-dark)
Select Custom to supply your own {z}/{x}/{y} tile URL template and optional attribution. Custom providers can be set globally (via settings) or per map.
Localization
- Text domain:
wp-multi-location-map - Translation template:
languages/wp-multi-location-map.pot
Load your .po/.mo files in the same directory to translate the admin UI and front-end strings.
Development
- Source entry point:
wp-multi-location-map.php - Core classes:
includes/ - Assets:
assets/js/andassets/css/ - Leaflet is loaded from the official CDN (
https://unpkg.com/leaflet@1.7.1).
Pull requests are welcome. Please follow WordPress coding standards (PHPCS) and test on the latest WordPress release.
Changelog
1.0.0 – 2025-10-06
- Initial public release.
License
GPL-2.0-or-later. See the plugin header or http://www.gnu.org/licenses/gpl-2.0.txt for details.
Credits
- Built on Leaflet.
- Tiles provided by OpenStreetMap, Stamen, and CARTO (depending on selection).