| 开发者 | wfy24 |
|---|---|
| 更新时间 | 2026年5月27日 05:31 |
| PHP版本: | 8.1 及以上 |
| WordPress版本: | 7.0 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
[wfy24_weather]
Override per instance:
[wfy24_weather city="paris-fr2988507" theme="dark" variant="forecast" lang="fr"]
Or use the WFY24 Weather Widget block in the Gutenberg editor for a visual interface.
Attribution
The free version of this plugin displays a small "Weather by WFY24" link under each rendered widget. The onboarding wizard shows an explicit disclosure notice and asks for your consent before the "Activate now (free)" button; clicking that button is your explicit permission to enable the link. To remove the attribution, a Pro version is available at wfy24.com/en/widgets/pro.
External service
This plugin connects to the WFY24 weather service at https://www.wfy24.com:
/api/widget/register-from-plugin with the email you confirmed in the onboarding form (pre-filled from Settings → General; editable inline before activation), site name, site domain, WordPress version, and plugin version, in order to automatically provision your free API key. No activation happens without your explicit click on the "Activate now (free)" button./wp-json/wfy24/v1/cities proxies your search query (e.g. "athens") to /api/places/search server-side. Your search query is sent along with a User-Agent identifying the plugin. Results (slug + label + country flag) are cached for 5 minutes per query. The admin's IP is never exposed cross-origin because the request is server-to-server.widget.js and queries /api/widget/data. The widget sends the API key, optional city slug, language/units/theme preferences, and a data-geolocation flag (off by default — visitor location is not detected unless the admin explicitly opts in via the "Auto-detect visitor location" toggle). When the toggle is on AND the visitor grants permission, the visitor's latitude/longitude is sent; when geolocation is denied, the visitor's IP address is used for IP-based city detection (still gated by the toggle). No personal data is stored beyond standard anonymized request logs for rate limiting./api/widget/pro/status and POSTs to /api/widget/pro/checkout and /api/widget/pro/portal to provision a Stripe Checkout session and a Stripe Billing Portal session. No data is sent unless the admin clicks the relevant button./wp-content/plugins/wfy24-weather-widget/, or install via Plugins → Add New.[wfy24_weather] to any post, page, or widget area.Yes. No credit card, no trial, no ads in the widget. Fair-use rate limits apply (plenty for normal sites).
No. The plugin registers your site automatically on activation using your WordPress admin email. You can also enter a key manually if you already have one.
Yes — visit wfy24.com/en/widgets to manage keys. Any changes you make there apply to this plugin immediately (keys are shared).
Minimal. See the "External service" section above. The plugin only contacts wfy24.com on actions you explicitly trigger (activation click, widget rendering on visitor pages, Pro upgrade click). There is no background telemetry, no scheduled cron, and no analytics.
The widget uses Shadow DOM for style isolation, so it won't clash with your theme. Choose from 5 layouts (Classic, Compact, Minimal, Badge, Forecast) and 3 themes (Auto, Light, Dark).
50 languages. Set the lang attribute to any ISO 2-letter code.
Go to wfy24.com, search for your city, and copy the slug from the URL (e.g. paris-fr2988507).
Yes. The widget loads client-side, so full-page cache has no impact on weather freshness.
Yes — we ship a "WFY24 Weather Widget" block under the Widgets category.
WFY24 combines multiple NWP models (DWD ICON-D2, ICON-EU, ICON-Global, GFS fallback) with ML post-processing (XGBoost) and real observations from 19,000+ weather stations (METAR, SYNOP, CWOP, DWD, etc.).
Yes. The free version of this plugin displays a small "Weather by WFY24" link under each rendered widget. This is disclosed explicitly during activation — the onboarding wizard shows a notice asking you to agree before you click "Activate now (free)". Clicking "Activate" is your explicit consent. The link is how we keep the service free for everyone.
Yes — by upgrading to Pro, which removes the link, increases the request rate limit, and unlocks additional features. The free version keeps the attribution as a fair trade for unlimited free data.
aqi-wide, the settings-page preview now breaks out of the right-hand sidebar and renders in a full-width row above the form, so the horizontal weather + AQI bar has room to show its actual layout. On the published page nothing changes — the variant has always rendered correctly when given content-width room.variant="aqi-wide" style places the location, current weather (icon, temperature, conditions, feels-like, daily high/low) on the left and a horizontal European-AQI bar (0–100+) with category label on the right. Designed for embeds that span the full content width, where the compact AQI card looks too narrow.width attribute — [wfy24_weather variant="aqi-wide" width="800px"] or width="100%". Accepts 400, 400px, 80%, 100%; invalid values are dropped silently. Set a site-wide default in Settings → WFY24 Weather Widget → Default width or override per shortcode / Gutenberg block. Empty value keeps each variant's built-in default.overflow:hidden and white-space:nowrap, but the segments inside didn't carry data-fit-priority hints — so when the embed sat in a narrow column (e.g. the admin's live-preview sidebar) the fit observer didn't know which parts to hide and the "Powered by WFY24" link was clipped mid-letter. Now the powered-by link, the description, the "Feels like" segment, and their dividers each have priorities; the observer hides them cleanly in priority order until everything fits.?ver=2.0.0 query had been cached on the CDN with the original 2.0.0 bundle, so even after the widget.js fix landed on the origin, sites embedding the script kept loading the stale copy. ?ver=2.0.1 is a fresh cache key.variant="aqi" style renders European-AQI air quality for the configured city — the big AQI index number, category band (good through hazardous, color-coded per the EEA scale), and the four headline pollutants (PM2.5, PM10, O₃, NO₂). Data comes from the Copernicus Atmosphere Monitoring Service (CAMS) via wfy24.com. Pick it from the "Style variant" dropdown in settings, or set it inline with [wfy24_weather variant="aqi"].wfy24-welcome URL still works — it now redirects to the unified screen.cities="..."). The v1.7.x multi-city feature is removed in this major release — the implementation needed a dedicated admin picker UI to be discoverable, and the new unified layout focuses on the most common single-city flow. If you had multi-city enabled, your shortcodes without cities= now fall back to your Default City; explicit [wfy24_weather cities="..."] shortcodes will only render the first city. The wfy24_default_cities option is preserved on update so no data is lost in case the feature returns later.widget.js is unchanged, so every existing shortcode and Gutenberg block in published posts continues to render exactly as before.WebPageElement block describing the city (as Place), language, units, and provider. Helps search engines and AI agents understand that the page contains a weather forecast for a specific location — useful for semantic search, AI overviews, and future rich-result eligibility. Toggle from the settings screen (on by default).url is the real canonical (e.g. https://www.wfy24.com/el/weather/thessaloniki-gr57554537) and the Place.name uses the language-correct form pulled from the translations table (İstanbul for tr, Θεσσαλονίκη for el, etc.). Cached in a WP transient for 24h on hit, 5min on miss — first page load makes one upstream call, all subsequent renders are cache hits.wfy24_jsonld_enabled (per-widget on/off) and wfy24_jsonld_data (modify the payload before emission).widget.js is unchanged. Existing shortcodes and blocks render exactly as before with the new JSON-LD appended.display: none as the default state for the suggestion list; the JavaScript was clearing the inline override (element.style.display = '') which fell back to that CSS default — so the dropdown was always hidden, even though the REST proxy was returning matches and no console errors were thrown. Now sets display: block explicitly. Affects both the Default City picker and the Language combobox on the settings and onboarding screens./wp-json/wfy24/v1/cities now returns structured fields (slug, name, country_code, country_name, flag, region) instead of a single pre-formatted label. Cache key includes the locale so per-language responses don't collide.navigator.geolocation whenever no default city was set, which triggered a browser permission prompt on every visitor and silently broke when declined. Auto-detect is now an explicit opt-in checkbox; the default is to honour the admin-set city, which matches what 95%+ of sites actually want (e.g. a tourism site for Crete shouldn't show a Swedish visitor's local weather)./wp-json/wfy24/v1/cities) so the admin's IP is never exposed cross-origin.Cross-Origin-Resource-Policy: cross-origin, which makes the widget work in cross-origin-isolated environments (e.g. playground.wordpress.net) that ship Cross-Origin-Embedder-Policy: require-corp.wp_redirect() calls in the Pro flow (Stripe Checkout and Billing Portal) with wp_safe_redirect() plus a scoped allowed_redirect_hosts filter that whitelists checkout.stripe.com, billing.stripe.com, and pay.stripe.com. The redirect helper validates the target host against this list before issuing the redirect, falling back to a safe admin URL on mismatch.<script> tags with wp_enqueue_script. All three call sites — the [wfy24_weather] shortcode, the admin-settings live preview, and the onboarding wizard preview — now register the widget bundle through WordPress's enqueue API and emit a <div data-wfy24-widget …> placeholder where the widget should render.[data-wfy24-widget] elements and renders inside the placeholder you mark, so WordPress hosts can keep the script in the page footer (per directory guidelines) without breaking in-place rendering. The legacy inline-<script> pattern still works unchanged for non-WordPress integrations.strategy => 'async' enqueue option.Telemetry checkbox has been removed from the Settings page. Existing scheduled events are cleared on upgrade and on deactivation.data-attribution="0" or "1" to widget.js accordingly.data-attribution attribute (hardcoded to "1" in the free plugin; Pro version sends "0" to suppress the link).[wfy24_weather] with city, theme, lang, units, variant attributes