=== WeatherBot Weather Widget === Contributors: roxxistudios Tags: weather, weather widget, current weather, local weather, google weather Requires at least: 6.0 Tested up to: 6.8 Requires PHP: 7.4 Stable tag: 1.0.7 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html Blocks: roxxistudios/weatherbot Live local current weather widget for WordPress (Google Weather). Gutenberg block + shortcode; fast, accessible, no jQuery on the front end. == Description == [WeatherBot](http://roxxistudios.com/weatherbot) displays **live weather** for any location in the world using **Google’s Weather API**, with city/place resolution via **Google Maps Geocoding/Places**. Use with a **Classic Widget**, a **Gutenberg block** (with live preview), or with a **shortcode** anywhere shortcodes are supported. Outputs a clean, accessible UI that works in any theme or builder. ### Gutenberg Block + Classic Widget Insert the **WeatherBot** block from the add widget panel (search “WeatherBot”). The block renders a **live server preview** and includes these controls: - **Title** (`pre_text`) — optional heading above the widget - **Show Title** (`show_pre_text`) — `1` (show) or `0` (hide) - **Position** (`align`) — `left`, `center`, `right` - **Theme** (`font_color`) — `light`, `dark` contrast - **Unit** (`unit`) — `IMPERIAL` (°F), `METRIC` (°C), or inherit from Settings - **Type** (`type`) — `badge`, `compact`, `inline` - **City** (`city`) — type a city and press **Enter** to preview The block supports **Dimensions → Margin** for per-instance spacing. Theme alignment (e.g., wide/full) is supported where available. ### Shortcode Use `[weatherbot]` (or `[weather_bot]`). Examples below are code-formatted so they render correctly. **Basic:** [weatherbot city="Lake Arrowhead, CA"] **Badge type with °F:** [weatherbot city="Lake Arrowhead, CA" unit="IMPERIAL" type="badge"] **Title + right aligned:** [weatherbot city="Lake Arrowhead, CA" type="badge" pre_text="Current Weather" align="right"] **Hide the title (show_pre_text=0):** [weatherbot city="Lake Arrowhead, CA" pre_text="Current Weather" show_pre_text="0"] **High-contrast for dark backgrounds:** [weatherbot city="Lake Arrowhead, CA" type="badge" font_color="light"] **Compact layout (°C):** [weatherbot city="Lake Arrowhead, CA" type="compact" unit="METRIC"] **Inline layout (flows with text; omit align):** [weatherbot city="Lake Arrowhead, CA" type="inline" pre_text="Now:"] **All options:** [weatherbot city="Lake Arrowhead, CA" unit="IMPERIAL" type="badge" pre_text="Current Weather" show_pre_text="1" align="center" font_color="dark"] == Features == * **Live local current weather** via **Google Weather API** * **Google Maps Geocoding/Places** for accurate city/place lookups * **WordPress weather block** with **live server preview** and full controls (Title, Show/Hide Title, Position, Theme, Unit, Type, City) * **WordPress weather shortcode** that **works anywhere shortcodes are supported** — posts, pages, widgets, Core/HTML block, most builders, and PHP templates via `echo do_shortcode()` * **Three display layouts** — `badge` (card), `compact` (mini), `inline` (text-flow) * **Optional title with on/off toggle** via `show_pre_text` (shortcode & block) * **Contrast themes** — **Light** / **Dark** for different backgrounds * **Units** — **Fahrenheit (°F)** or **Celsius (°C)**; can inherit from Settings * **Classic Widget** support (with **Align** option) * **Accessibility-minded markup** and focus styles * **Builder-friendly output** — guards against unwanted `
` wrappers and extra spacing * **Caching tuned for freshness** — weather (~2 minutes per location/unit); geocoding (long-lived) * **Manual cache purge** from Settings * **Optional uninstall cleanup** — delete plugin data on uninstall if enabled * **CSS variables** for easy theming (`--wb-primary`, `--wb-secondary`, `--wb-neutral`, etc.) * **No jQuery on the front end** — built with modern WordPress packages and vanilla JS * **COMING SOON:** Our **Pro version** with **weather forecast** and other powerful features like **detailed style controls**. == Installation == = From your WordPress dashboard = 1. Go to **Plugins → Add New**. 2. Search for **WeatherBot**. 3. Click **Install Now**, then **Activate**. 4. Go to **Settings → WeatherBot**, add your **Google Maps API key** (enable **Weather** and **Geocoding/Places** APIs), and save. 5. **Block:** insert **WeatherBot**, choose options, type a city and press **Enter** to preview. **— or —** **Shortcode:** paste one of the examples above. = Manual installation = 1. Upload the `weatherbot` folder to `/wp-content/plugins/`. 2. Activate the plugin in **Plugins**. 3. Go to **Settings → WeatherBot**, add your **Google Maps API key** (enable **Weather** and **Geocoding/Places** APIs), and save. 4. **Block:** insert **WeatherBot**, choose options, type a city and press **Enter** to preview. **— or —** **Shortcode:** paste one of the examples above. == Frequently Asked Questions == = 1. DOES THIS SHOW LIVE LOCATION WEATHER USING GOOGLE WEATHER? = Yes. WeatherBot retrieves **current weather** from **Google’s Weather API** and resolves your `city` input with **Google Maps Geocoding/Places**. = 2. WHERE DO I GET A GOOGLE API KEY AND WHAT DO I ENABLE? = Create a key in the [**Google Cloud Console**](https://developers.google.com/maps/documentation/weather/get-api-key) and enable **Weather** and **Geocoding/Places** APIs. Restrict your key per Google’s guidance. = 3. CAN I USE THE SHORTCODE IN WIDGETS, HEADERS/FOOTERS, OR BUILDER MODULES? = Yes—anywhere WordPress **parses shortcodes**: posts, pages, widgets, the Core/HTML block, and most page builders. In a PHP template you can use: `` = 4. HOW OFTEN IS THE WEATHER UPDATED? CAN I CLEAR THE CACHE? = Weather results are cached briefly (about **2 minutes** per location/unit) to keep results fresh while saving API calls. Geocoding results can be cached long-term. You can **manually purge** caches from **Settings → WeatherBot**. = 5. DOES THE WIDGET SUPPORT DARK BACKGROUNDS? = Yes. Choose **Theme → Light/Dark** (or `font_color` shortcode attribute) to ensure readable contrast. = 6. DOES THIS PLUGIN TRACK VISITORS OR SEND DATA TO THIRD-PARTY SERVERS? = No. API calls go directly from **your site** to **Google** using **your** key. The plugin does not phone home. = 7. IS JQUERY REQUIRED? = **No jQuery on the front end.** WeatherBot runs on vanilla JS and WordPress packages. (The WP admin may load standard WordPress scripts.) == Attributes == - `city` — string (e.g., `"Lake Arrowhead, CA"`) - `unit` — `IMPERIAL` | `METRIC` | empty to inherit from Settings - `type` — `badge` | `compact` | `inline` | empty to inherit - `pre_text` — string (optional title above the widget) - `show_pre_text` — `1` | `0` (default `1`) — show/hide the title above the widget - `align` — `left` | `center` | `right` - `font_color` — `light` | `dark` == Screenshots == 1. Settings page with API key field and connection test 2. Google API Usage Dashboard 3. Badge type with title 4. Compact type 5. Inline type in body text 6. Block with live preview and controls == Changelog == = 1.0.7 = * Fixed alignment for inline widget for improved alignment in paragraph. * Expanded ReadMe file content. = 1.0.6 = * Fixed duplicate stylesheet on the front end when the block is present (unified handle/guarded enqueue). * Documented `show_pre_text` option in readme. * Improved styles for better layout control. * Modified Widget setting fields layout order. = 1.0.5 = * Enhanced responsive styles and improved uninstall cleanup procedure. = 1.0.4 = * Added "Align" option to the WeatherBot Widget (left, center, right, inherit). = 1.0.3 = * Minor CSS refinements for responsive styling. = 1.0.2 = * Improved badge layout styles. = 1.0.1 = * Added uninstall.php for cleanup on plugin deletion. * Added user setting to control data deletion. * Updated assets (icons, screenshots, logos). * Improved settings page layout. = 1.0.0 = Initial release. == External services == This plugin connects to third-party services to fetch weather and/or geocoding data. = Google Weather / Google Maps Platform = - **Usage:** retrieves current conditions and converts place names to coordinates. - **Data sent:** the query you provide (e.g., “Lake Arrowhead, CA”) or latitude/longitude. - **Provider terms:** https://cloud.google.com/maps-platform/terms - **Google APIs Terms:** https://developers.google.com/terms - **Privacy policy:** https://policies.google.com/privacy - **Notes:** Site owners provide their own API keys. No data is sent to RoxxiStudios servers. Geolocation is not used. = Caching = The plugin may cache API responses (weather lookups and reverse-geocoded place names) in your WordPress database to reduce network calls and improve performance. Cache lifetimes are limited and can be cleared by site admins at any time.