viget / viget-google-maps-block
Google Maps blocks for any post type: background geocoding, clustering, search, near me and an accessible results list. FacetWP optional.
Package info
github.com/vigetlabs/viget-google-maps-block
Type:wordpress-plugin
pkg:composer/viget/viget-google-maps-block
Requires
- composer/installers: ^1.0 || ^2.0
Requires (Dev)
- phpunit/phpunit: ^9.6
- yoast/phpunit-polyfills: ^4.0
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Viget Google Maps Block
Google Maps blocks for any post type. Background geocoding, clustering, search, "use my location" and an accessible results list. FacetWP optional.
Installation
Manual: download the latest release zip and upload it under Plugins → Add New.
Composer:
composer require viget/viget-google-maps-block
Setup
Add keys under Settings → Google Maps, or in wp-config.php (environment variables with the same names also work):
define( 'VGTGMB_BROWSER_KEY', '...' ); // Maps JavaScript API, restricted to your domains. define( 'VGTGMB_SERVER_KEY', '...' ); // Geocoding API. Never printed on the page. define( 'VGTGMB_MAP_ID', '...' ); // Cloud-based map style.
Then add a Map block to a page. It includes search, the map and results by default. Filters are optional.
Add locations under Locations, or point the map at any post type under Settings → Google Maps → General and map its meta with vgtgmb_location_fields.
Features
- Pins for street addresses. PO boxes and city- or state-only locations show in results when the map covers their boundary.
- Geocoding runs in the background. Manual coordinates override it.
- Clustering, search, "use my location", distance, directions, info windows and URL state. Turn any off site-wide or per map.
- Works with FacetWP when it's active.
- Theme template overrides at
{theme}/viget-google-maps-block/. - Translation-ready and WPML compatible.
Boundaries come from OpenStreetMap Nominatim (© OpenStreetMap contributors, ODbL).
Developer API
Filters, actions, REST routes and template overrides are in docs/api.md.
Auto-Updates
The plugin checks GitHub releases every 12 hours and surfaces updates in Plugins. See includes/class-github-plugin-updater.php.
Development
npm install npm run build # build/ is committed npm run lint:js npm run lint:css composer install npm run env:start # requires Docker npm test phpcs --standard=.phpcs.xml .
See AGENTS.md for release steps and conventions.
Changelog
See readme.txt.
License
GPL-2.0-or-later