Interactive · Gutenberg
Weather Widget block for WordPress
Live weather display with current conditions, temperature, humidity, wind speed and a 5-day forecast. Powered by OpenWeatherMap free API.
Get Blockenberg
Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.
What it actually does
Live weather display with current conditions, temperature, humidity, wind speed and a 5-day forecast. Powered by OpenWeatherMap free API.
Inspector panels on this block: API & Location, Display Options, Layout, Background. Those titles come from index.js, not from a shared template.
Behavior controls: “OpenWeatherMap API Key” (Free key from openweathermap.org); “Default City” (e.g. London, New York, Tokyo); “Units” options: Celsius (°C), Fahrenheit (°F), Kelvin (K); “Language” options: English, Russian, German, French, Spanish.
Where to find it
Gutenberg inserter → Interactive → search “Weather Widget” (block name `blockenberg/weather-widget` in block.json). Style it in the sidebar after insert.
How to use Weather Widget block for WordPress
- Install Blockenberg. Install from WordPress.org and activate the plugin.
- Insert the block. Edit a page, click +, search for “Weather Widget”, insert it. Category: Interactive.
- Configure inspector controls that exist on this block. Open API & Location. Set “OpenWeatherMap API Key”, “Default City”, “Auto-detect visitor location (Geolocation)”, “Units”.
- Check the published page. The view script reads HTML data attributes: data-opts, data-ww-refresh. The block editor preview may not run the same view script.
Inspector controls from this block’s code
| Control | What the code does |
|---|---|
| OpenWeatherMap API Key | Text field in the inspector. Free key from openweathermap.org. Saved as `apiKey`. |
| Default City | Text field in the inspector. e.g. London, New York, Tokyo. block.json default: London. Saved as `city`. |
| Auto-detect visitor location (Geolocation) | On/off toggle in the inspector. Off by default. Saved as `autoLocation`. |
| Units | Select control; the chosen value is saved on the block. Options: Celsius (°C); Fahrenheit (°F); Kelvin (K). block.json default: metric. Saved as `units`. |
| Language | Select control; the chosen value is saved on the block. Options: English; Russian; German; French; Spanish; Japanese. block.json default: en. Saved as `lang`. |
| Auto-refresh interval (minutes) | Numeric range control in the inspector. 0 = no refresh. Range 0–60. block.json default: 10. Saved as `refreshInterval`. |
| Show feels-like temperature | On/off toggle in the inspector. On by default. Saved as `showFeelsLike`. |
| Show humidity | On/off toggle in the inspector. On by default. Saved as `showHumidity`. |
| Show wind speed | On/off toggle in the inspector. On by default. Saved as `showWind`. |
| Show pressure | On/off toggle in the inspector. Off by default. Saved as `showPressure`. |
| Show visibility | On/off toggle in the inspector. Off by default. Saved as `showVisibility`. |
| Show animated weather icon | On/off toggle in the inspector. On by default. Saved as `showAnimatedIcon`. |
| Show 5-day forecast | On/off toggle in the inspector. On by default. Saved as `showForecast`. |
| Forecast days | Numeric range control in the inspector. Range 2–5. block.json default: 5. Saved as `forecastDays`. |
| Layout | Select control; the chosen value is saved on the block. Options: Card (centered); Wide (full-width); Minimal (compact). block.json default: card. Saved as `layout`. |
| Max width (px) | Numeric range control in the inspector. Range 280–800. block.json default: 480. Saved as `maxWidth`. |
| Padding (px) | Numeric range control in the inspector. Range 8–64. block.json default: 32. Saved as `padding`. |
| Outer radius (px) | Numeric range control in the inspector. Range 0–48. block.json default: 24. Saved as `borderRadius`. |
| Card radius (px) | Numeric range control in the inspector. Range 0–32. block.json default: 16. Saved as `cardRadius`. |
| Background style | Select control; the chosen value is saved on the block. Options: Gradient (auto by weather); Custom color; Transparent. block.json default: gradient. Saved as `backgroundStyle`. |
| Text color | Color control in the inspector. block.json default: #ffffff. Saved as `textColor`. |
| Accent color | Color control in the inspector. block.json default: #60a5fa. Saved as `accentColor`. |
| Card background | Color control in the inspector. block.json default: rgba(255,255,255,0.12). Saved as `cardBg`. |
| Forecast day background | Color control in the inspector. block.json default: rgba(255,255,255,0.08). Saved as `forecastBg`. |
What the front-end script actually does
- The view script reads HTML data attributes: data-opts, data-ww-refresh.
- Submit/load uses fetch or wp.apiFetch on the published page, not the editor canvas.
When this is the right block
- Live weather display with current conditions, temperature, humidity, wind speed and a 5-day forecast. Powered by OpenWeatherMap free API — that is the job of Weather Widget, not a generic content block.
- Use it when you need the editor control labeled “OpenWeatherMap API Key”, which exists on this block’s inspector.
- It matches pages about weather, forecast, temperature.
- Inserter grouping: quizzes, games, and click-to-reveal experiences.
Notes from the implementation
viewScript: this folder’s frontend.js is enqueued on the front end for this block.
FAQ
How do I add the Weather Widget block in WordPress?
Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “Weather Widget”. It sits under Interactive. After insert, open API & Location and set “OpenWeatherMap API Key”, “Default City”, “Auto-detect visitor location (Geolocation)”, “Units”.
What makes Weather Widget different from other Blockenberg blocks?
Live weather display with current conditions, temperature, humidity, wind speed and a 5-day forecast. Powered by OpenWeatherMap free API. Inspector labels on this block include “OpenWeatherMap API Key”, “Default City”, “Auto-detect visitor location (Geolocation)”, “Units”.
Is the Weather Widget Gutenberg block free?
Yes. Weather Widget ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.
Can I style Weather Widget to match my theme?
Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: API & Location, Display Options, Layout, Background).
Related interactive blocks
Analog Clock
A beautiful live analog clock rendered with SVG. Fully customizable: clock style, timezone, colors, size, and optional date/time labels.
World Clock
Display live clocks for multiple timezones with analog or digital style. Perfect for global audiences, remote teams, and travel blogs.
2048 Game
The classic sliding-tile 2048 puzzle. Swipe or use arrow keys to merge tiles and reach the 2048 tile.
Bingo Card
Interactive 5×5 Bingo card with number calling, win detection, and celebration animations.
Content Score
Visual content or SEO scoring card with circular gauge, color-coded criteria rows, and overall grade.
Dice Roller
Interactive dice roller supporting d4, d6, d8, d10, d12, d20 and d100. Roll multiple dice, see individual results, totals, and past roll history.
Get Blockenberg
Install Blockenberg from WordPress.org, then insert Weather Widget from the Gutenberg inserter.