| 开发者 | spelhubben |
|---|---|
| 更新时间 | 2026年9月7日 21:57 |
| 捐献地址: | 去捐款 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 7.1 |
[spelhubben_weather] anywhere shortcodes are supported.[spelhubben_weather][spelhubben_weather place="Gothenburg" layout="compact" map="1" animate="1"][spelhubben_weather lat="57.7089" lon="11.9746" layout="inline" map="0" show="temp,icon"][spelhubben_weather place="Umeå" layout="detailed" forecast="daily" days="5" providers="smhi,yr,openmeteo,fmi"][spelhubben_weather place="Stockholm" show="temp,wind,wind_dir,icon" layout="compact" animate="1"][spelhubben_weather hourly="1" hours="24" layout="compact"][spelhubben_weather map="1" map_engine="openlayers"][spelhubben_weather preset="dashboard" hourly="1" map="1"]From public APIs such as Open-Meteo, SMHI, Yr/MET Norway, MET Norway Nowcast, FMI (Finnish Meteorological Institute), OpenWeatherMap, and WeatherAPI.com. You choose providers under Settings → Spelhubben Weather or per block/shortcode/widget via the providers attribute.
Usually no. Open-Meteo, SMHI, Yr/MET Norway, MET Norway Nowcast, and FMI do not require keys. OpenWeatherMap and WeatherAPI.com do require API keys, and for Yr/MET Norway it’s recommended to include contact info (email/URL) in Settings → Spelhubben Weather → Yr contact/UA so your User-Agent is compliant.
All three render the same UI. Use the block in the block editor, the shortcode in classic content areas, and the widget in sidebars (Appearance → Widgets). Each lets you override global defaults.
If you're testing experimental tide support:
Tides in Settings → Spelhubben Weather and select a provider (WorldTides, NOAA or Custom endpoint). WorldTides typically requires an API key.extras="tides" or tides="1" to show tide events, e.g. [spelhubben_weather place="Gothenburg" extras="tides"].events/extremes/data arrays (items should include time, and optionally type and height).tests/tide_test.php to validate provider responses and caching. Ensure provider settings and API key are correct; tide results are cached according to the configured TTL.lat and lon are provided they take precedence. Otherwise the plugin geocodes the place string (e.g. place="Umeå"). Set a global default place in settings.
Use show="temp,wind,icon" (comma separated). Defaults are set in settings. Add wind_dir to show wind direction arrow and label.
Choose layout="inline|compact|card|detailed". “Detailed” supports the multi-day forecast row.
Yes! Use comparison="1" to show all enabled providers' data side-by-side. Useful for debugging or comparing which providers are available in your location.
Example: [spelhubben_weather place="Stockholm" comparison="1" providers="openmeteo,smhi,yr,fmi,openweathermap,weatherapi"]
The plugin offers multiple themes: Classic (traditional), Modern Flat (clean, minimalist), Modern Gradient (contemporary with subtle gradients), Modern 2026 (duotone/stroke modern style), and Modern 3D (subtle gradients + drop-shadows). Choose in Settings → Spelhubben Weather → Icon style. All themes include icons for sun, partly-cloudy (including alternate), cloud, fog, rain, sleet, snow, storm/thunder, and hail where applicable.
map="1" shows a smart OpenStreetMap-powered map. By default map_engine="auto" tries OpenLayers first, then Leaflet legacy, then a static fallback with coordinates and an OSM link. You can force map_engine="openlayers|leaflet|static". Control height with map_height="240" (px). Global defaults exist in settings.
Set hourly="1" and optionally hours="3–24". Example: hourly="1" hours="24". Hour labels follow the active site locale, such as 24-hour time for Swedish/Norwegian sites.
animate="1" adds subtle UI animation. Global default is in settings. The renderer also accepts true, yes, or on as truthy values for convenience.
Set forecast="daily" and days="3–10". Example: forecast="daily" days="5".
Use extras="moon" to show moon phase in the weather meta area. Use extras="moon_daily" together with forecast="daily" to show moon information in the daily forecast. Example: [spelhubben_weather extras="moon"].
Yes. Set providers="smhi,yr,openmeteo,fmi" (order doesn’t matter). The plugin calculates a simple consensus across available providers for the displayed fields.
Pick a preset with units="metric|metric_kmh|imperial". You can override parts via temp_unit="C|F", wind_unit="ms|kmh|mph", precip_unit="mm|in", and date_format for forecast labels. All have global defaults in settings (Units & format section).
Responses are cached with WordPress transients. Change TTL (minutes) in settings. Clear via the Clear cache button on the Performance page (Settings → Performance) or by changing attributes (which creates a new cache key).
Yes, rendering is server-side. Interactive maps require JS, but the map area can fall back to a static status with coordinates and an OpenStreetMap link.
The plugin is fully translatable. Included translations: Swedish (sv_SE), Norwegian Bokmål (nb_NO). Strings are also available on translate.wordpress.org. Bundled translation files live in /languages and include .pot, .po, .mo, .l10n.php, and block editor JSON files.
The plugin does not set cookies by itself. If you enable the map, OpenStreetMap tiles are requested client-side by the local OpenLayers/Leaflet runtime. Mention OSM in your privacy notice if needed.
lat/lon or a more specific place (e.g. “Uddevalla, SE”).map="1" and that your theme/container is wide/tall enough; increase map_height.The plugin is fully translatable and includes built-in translations for Swedish (sv_SE) and Norwegian Bokmål (nb_NO).
init for WordPress 6.7+ compatibility.ok, missing_key, no_coverage, request_failed, and no_data diagnostics.hourly="1" and hours="3-24" (default 24).map_engine, and map diagnostics in Performance./languages.13:00 for Swedish/Norwegian sites and 1:00 PM for US English.map_height is clamped in the renderer too, so shortcode/block/widget overrides consistently honor the documented 120px minimum.assets/map.min.js and added assets/style.min.css.units and yr_contact options to remove undefined index notices on new installs.wind_unit fallback is safe and notice-free.nonce is not defined error).assets/map.min.js from the source to eliminate the stray syntax error and keep parity with map.js.assets/vendor is included in distribution packages (adjusted .distignore rules). This prevents missing Leaflet vendor files after packaging/deploy.$post is not available.2.0.1.[spelhubben_weather], Gutenberg block, and classic widget
inline, compact, card, detailedshow=wind_dir)