Simple Weather Block
Simple Weather Block- the test tasks for NEXT.io for Nikolaj Popovic
by Your Name · github.com/nik-coder/simple-weather-block · website
Install
No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:
wp plugin install https://github.com/nik-coder/simple-weather-block/archive/refs/heads/main.zipDisplays current weather for any location, via a Gutenberg block, fetched from the free Open-Meteo API and cached server-side.
Description
Simple Weather Block adds a "Weather" block you can drop into any post or page. Editors set a latitude, longitude, and label in the block sidebar; the front end renders a small card with current temperature, wind speed, and conditions.
- No API key required (uses the free Open-Meteo API).
- Response is cached in a transient for 30 minutes, filterable via
swb_cache_ttl. - Fails gracefully: if the API is down or returns something unexpected, the block shows a quiet fallback message instead of a fatal error or blank page.
Installation
- Upload the
simple-weather-blockfolder to/wp-content/plugins/. - Activate the plugin through the "Plugins" screen.
- Add the "Weather" block to any post or page and set a latitude/longitude in the block settings panel.
Frequently Asked Questions
Does this require an API key?
No. It uses Open-Meteo (https://open-meteo.com), which is free and keyless for non-commercial use.
How long is data cached?
30 minutes by default. Use the swb_cache_ttl filter to change it.
Explanation
Changelog
1.0.0
- Initial release.