=== AddonLogic Event Location Map ===
Contributors: snehalpancholi
Tags: event, map, leaflet, location, geocode, openstreetmap, shortcode
Requires at least: 6.0
Tested up to: 6.7
Requires PHP: 8.1
Stable tag: 1.0.0
License: GPL-2.0+
License URI: https://www.gnu.org/licenses/gpl-2.0.html

Add an interactive Leaflet.js location map to event posts. Free Nominatim geocoding. No API key needed.

== Description ==

AddonLogic Event Location Map adds a clean, interactive map to event posts using the open-source Leaflet.js library and the free Nominatim geocoding API from OpenStreetMap. No API key is required.

**Key Features**

* Interactive Leaflet.js maps powered by free OpenStreetMap tiles
* Nominatim geocoding — enter an address, click a button, coordinates auto-fill
* Server-side geocoding fallback when saving a post
* 24-hour geocode result cache to respect Nominatim rate limits
* Works with the AddonLogic Simple Event Calendar `sec_event` post type and any public custom post type
* `[event_map]` shortcode to embed a map anywhere
* Auto-inject map into single post content (before or after)
* Admin preview map in the meta box
* Google Maps directions link with configurable label
* Optional address text display below the map
* No jQuery — vanilla JavaScript only
* Leaflet and OpenStreetMap attribution always included (as required)
* Settings page under Settings → Event Location Map

**Shortcode**

`[event_map]` — displays the map for the current post in The Loop.

`[event_map id="42" height="500px" zoom="12" show_directions="1"]` — displays the map for post ID 42.

**Shortcode Attributes**

| Attribute | Default | Description |
|---|---|---|
| id | current post | Post ID |
| height | 400px | Map height (any CSS unit) |
| zoom | 14 | Zoom level 1–20 |
| show_directions | 1 | Show Google Maps directions link |
| show_address | 1 | Show text address below map |
| show_venue | 1 | Show venue name |

== Installation ==

1. Upload the `event-location-map` folder to `/wp-content/plugins/`.
2. Activate the plugin through the Plugins screen.
3. Go to Settings → Event Location Map and choose which post types should display the location meta box.
4. Edit an event post, fill in the Event Location meta box, and click "Geocode Address".
5. Save the post — the map will appear automatically on the frontend.

== Frequently Asked Questions ==

= Does this require a paid map API key? =

No. The plugin uses free OpenStreetMap tiles via Leaflet.js and the free Nominatim geocoding API. No API key or account is required.

= What are the Nominatim usage limits? =

Nominatim's fair-use policy allows maximum one request per second. The plugin caches geocode results for 24 hours per unique address, so repeated saves do not trigger repeated requests.

= Does it work with WooCommerce or other CPTs? =

Yes. Go to Settings → Event Location Map and enable any public post type.

= Where is the map shown? =

On single post views (if Auto-Display is enabled) and wherever you place the `[event_map]` shortcode.

= What attribution is required? =

OpenStreetMap and Leaflet.js both require attribution. The plugin always renders the Leaflet attribution control with the OpenStreetMap copyright notice. Do not remove it.

== Changelog ==

= 1.0.0 =
* Initial release.
* Leaflet.js maps with OpenStreetMap tiles.
* Nominatim geocoding with 24-hour cache.
* [event_map] shortcode with six attributes.
* Auto-inject map into post content.
* Admin meta box with geocode button and preview map.
* Settings page under Settings → Event Location Map.

== Upgrade Notice ==

= 1.0.0 =
Initial release.
