=== AddonLogic Weather Widget ===
Contributors: snehalpancholi
Tags: weather, weather widget, openweathermap, weather shortcode, current weather
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

Display live weather conditions anywhere on your site via a simple shortcode or classic sidebar widget, powered by OpenWeatherMap.

== Description ==

**AddonLogic Weather Widget** lets you show real-time weather for any city using the free OpenWeatherMap API. Drop `[weather city="London"]` into any post, page, or widget area and get a beautifully styled weather card instantly.

= Key Features =

* **Live Weather Data** — current temperature, description, humidity, wind speed, and "feels like" temperature.
* **Smart Transient Caching** — data is cached per city (configurable: 1–720 minutes, default 30) to stay well within OWM's free-tier limits.
* **Multiple Display Styles** — Card, Dark Card, Minimal (inline), and Compact (badge) themes.
* **Shortcode Support** — `[weather city="Tokyo" units="metric" style="card"]`
* **Sidebar Widget** — fully configurable classic WordPress widget with title, city, units, and style settings.
* **Multiple Cities** — use the shortcode multiple times on the same page; each city is cached independently.
* **Units Toggle** — Metric (°C), Imperial (°F), or Standard (°K) — global default overridable per shortcode and widget.
* **Emoji Condition Icons** — weather conditions mapped to descriptive emoji (☀️ 🌧️ ⛈️ ❄️ 🌫️ …).
* **Graceful Error Handling** — city-not-found and API-unavailable states are displayed clearly without breaking the layout.
* **Admin API Key Tester** — test your API key with a single click directly from the settings page.
* **Responsive & Dark-Mode Ready** — adapts to mobile screens and respects `prefers-color-scheme`.
* **Translation Ready** — full text-domain support (`weather-widget`).
* **Automatic Updates** — checks for updates from the AddonLogic update server.

= Shortcode Usage =

Basic:
`[weather city="London"]`

With options:
`[weather city="New York,US" units="imperial" style="dark-card"]`

Minimal inline:
`[weather city="Tokyo" style="minimal" show_humidity="false" show_wind="false"]`

= Requirements =

* WordPress 6.0+
* PHP 8.1+
* A free OpenWeatherMap API key (https://openweathermap.org/api)

== Installation ==

1. Upload the `weather-widget` folder to `/wp-content/plugins/`.
2. Activate the plugin through **Plugins → Installed Plugins**.
3. Go to **Settings → Weather Widget**.
4. Enter your free OpenWeatherMap API key and click **Test API Key** to verify it works.
5. Configure default units, card style, cache duration, and which data fields to display.
6. Add `[weather city="YourCity"]` to any post or page, or drag the **AddonLogic Weather Widget** into a widget area from **Appearance → Widgets**.

== Frequently Asked Questions ==

= Where do I get an API key? =

Sign up for free at https://openweathermap.org/api — the "Current Weather Data" plan covers all plugin features with 60 calls/minute.

= How does caching work? =

Each unique city+units combination is stored as a WordPress transient. The default TTL is 30 minutes, configurable from 1 to 720 minutes in **Settings → Weather Widget**. Changing units or cache duration flushes all cached data automatically.

= Can I show weather for multiple cities? =

Yes. Place `[weather city="London"]` and `[weather city="Tokyo"]` anywhere on the same page. Each city has its own independent cache entry.

= What happens if the API is down? =

If the API returns an error or times out, the plugin displays a styled "weather data temporarily unavailable" message. Cached data is shown immediately; only a fresh call triggers a failure message.

= Is my API key secure? =

Yes. The API key is stored in `wp_options` and only used in server-side PHP calls. It is never included in frontend HTML output.

= How do I add weather to a page template? =

Use `echo do_shortcode('[weather city="London"]');` in any template file.

== Screenshots ==

1. Card style — sunny condition with yellow header gradient.
2. Dark Card style — ideal for dark-themed sites.
3. Compact badge and Minimal inline display styles.
4. Settings page with API key tester and cached cities panel.
5. Classic sidebar widget configuration in Appearance → Widgets.

== Changelog ==

= 1.0.0 =
* Initial release.
* Shortcode `[weather]` with city, units, style, show_humidity, show_wind, show_feels_like attributes.
* Four visual styles: card, dark-card, minimal, compact.
* Smart per-city transient caching with configurable TTL.
* Sidebar widget with instance-level title, city, units, and style settings.
* Admin settings page with API key tester, cache flush, and shortcode reference.
* Responsive layout and dark-mode support via CSS variables.
* Seven weather condition emoji groups.
* Graceful error states for missing key, city not found, and API unavailability.
* Automatic update check against AddonLogic update server.

== Upgrade Notice ==

= 1.0.0 =
Initial release — no upgrade needed.
