| 开发者 | spelhubben |
|---|---|
| 更新时间 | 2026年1月31日 05:06 |
| 捐献地址: | 去捐款 |
| PHP版本: | 7.4 及以上 |
| WordPress版本: | 6.9 |
[spelhubben_weather], Gutenberg block, and classic widgetinline, compact, card, detailedshow=wind_dir)[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"]From public APIs such as Open-Meteo, SMHI, Yr/MET Norway, and FMI (Finnish Meteorological Institute). You choose providers under Settings → Spelhubben Weather or per block/shortcode/widget via the providers attribute.
No. Open-Meteo, SMHI, and FMI do not require keys. 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 tide support in version 1.9.7:
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 Leaflet map (OpenStreetMap). Control height with map_height="240" (px). Global defaults exist in settings.
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 the new phase and illumination fields to show moon information. Example shortcode: [spelhubben_weather show="temp,icon,phase,illumination"] — available in Block inspector and Widget options as well.
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. The map (Leaflet) requires JS.
The plugin is fully translatable. Included translations: Swedish (sv_SE), Norwegian (nb_NO). Strings are also available on translate.wordpress.org. Ship .pot/.po/.mo in /languages.
The plugin does not set cookies by itself. If you enable the map, Leaflet/OpenStreetMap tiles are requested client-side. 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).
extras="tides" or tides="1". Admin visibility can be toggled while rolling out to selected users. Responses are cached; configure TTL in Settings.phase (name) and illumination (percent) available in renderer, shortcodes, block and widget.wind_unit override in Block inspector, Widget settings and Shortcodes Quick Builder.metric_knt preset for metric display with knots.wind_unit reliably overrides resolved units and renderer emits data-svv-wind-unit for debugging.theme attribute — theme="auto|light|dark" to force UI theme per instance (default auto).data-svv-theme and svv-theme-<value> class for easier CSS targeting.theme when generating shortcodes; docs updated across readmes.wind_dir) — rotated arrow + cardinal labels (optional via show=wind_dir)aria-live for accessibilityanimate attribute parsing is more tolerant (accepts 1, true, yes, on)spelhubben/weather → spelhubben-weather/spelhubben-weather) preventing proper asset enqueuingmap.jsis_active_widget()height: 240px;) to .svv-map CSS class for better Leaflet container sizing.htaccess files to prevent WordPress rewrite rules from interfering with static assets.includes/constants.php) for improved code maintainability and reduced magic numbers.sv_vader_ prefix.sv_vader_get_options() calls).build_icon_url() to centralize icon URL logic and improve maintainability.[sv_vader …] shortcode. Use [spelhubben_weather …] exclusively.comparison="1" attribute shows all providers' data side-by-side for easy comparison and debugging.contain: layout style paint) optimizes rendering on pages with multiple weather cards.LIBXML_NOCDATA flag with proper error handling).providers="…" in block/shortcode/widget.providers now accepts fmi.date_format).filemtime.