Skip to main content

Venue Maps

SportsPress displays an interactive map on venue archive pages and on individual event pages when the event has a venue assigned. The map is rendered using OpenStreetMap tiles via the Leaflet JavaScript library, which is bundled with the core Sports…

Updated today

Venue Maps

SportsPress displays an interactive map on venue archive pages and on individual event pages when the event has a venue assigned. The map is rendered using OpenStreetMap tiles via the Leaflet JavaScript library, which is bundled with the core SportsPress plugin.

How Maps Are Displayed

The map system uses a WordPress action hook, sp_venue_show_map, called from the venue-map.php template with the venue's latitude, longitude, address, zoom level, and map type as arguments. The OpenStreetMap module (bundled in the core plugin at includes/sportspress/modules/sportspress-openstreetmap.php) hooks into this action and renders the map.

A map is shown only when both Latitude and Longitude are set on the venue. If coordinates are missing, no map is rendered.

Where Maps Appear

  • Venue archive pages — the map appears at the top of the page when a visitor views a venue's public URL (e.g. /venue/old-trafford/).

  • Event pages — if an event is assigned a venue with coordinates, the venue section of the event page renders a map.

  • Shortcode — the [event_venue] shortcode includes the map when the event has a mapped venue.

Map Settings

Map display options are found at Events > Settings, under the Venues section:

  • Venue Map (sportspress_event_show_maps) — checkbox to enable or disable venue map display globally. Default: on.

  • Type (sportspress_map_type) — choose the tile source:

    • Default (ROADMAP) — standard OpenStreetMap street map tiles from tile.openstreetmap.org

    • Satellite (SATELLITE) — satellite imagery tiles from ArcGIS Online (Esri World Imagery)

  • Zoom (sportspress_map_zoom) — integer zoom level, range 0–21. Default: 15. Higher values zoom in further (street level), lower values zoom out (continent level).

These settings are read by the venue-map.php template and passed to the sp_venue_show_map action.

Venue Coordinates

Coordinates are stored per venue in the WordPress options table:

  • Latitude — stored as sp_latitude in the taxonomy_<term_id> option array

  • Longitude — stored as sp_longitude in the taxonomy_<term_id> option array

To set coordinates, edit the venue at Events > Venues and drag the map marker to the venue's location, or type decimal degree values directly into the Latitude and Longitude fields.

OpenStreetMap Rendering Details

The Leaflet map container is rendered as a 320px-tall div wrapping an anchor tag that links to the equivalent Google Maps page for the coordinates. The map is initialized with panning, touch zoom, double-click zoom, and scroll-wheel zoom all disabled — the map is display-only, not interactive.

A standard pin marker is placed at the stored coordinates.

For satellite imagery, tiles come from the ArcGIS Online World Imagery service. For the default (roadmap) type, tiles come from the public OpenStreetMap tile server.

Google Maps Integration

The SportsPress Pro plugin includes a SportsPress Google Maps Integration module (includes/sportspress-google-maps/). When this module is active, it removes the OpenStreetMap handler from the sp_venue_show_map hook and replaces it with a Google Maps iframe renderer.

The Google Maps module renders the map as an <iframe> embedding a Google Maps tile via tboy.co/maps_embed (a proxy for the Google Maps Embed API). The iframe is 600×320 pixels. An overlay anchor links to the full Google Maps page for the address.

The Google Maps module does not add its own settings to the Event Settings screen; it uses the same sportspress_map_zoom and sportspress_map_type settings as the OpenStreetMap module. Only one map renderer is active at a time: Google Maps replaces OpenStreetMap when the module is loaded.

Did this answer your question?