[WordPress] 外掛分享: Weather Forecast Widget

首頁外掛目錄 › Weather Forecast Widget
WordPress 外掛 Weather Forecast Widget 的封面圖片
200+
安裝啟用
★★★★
4/5 分(3 則評價)
229 天前
最後更新
問題解決
WordPress 3.0.1+ v1.1.7 上架:2021-04-09

內容簡介

一般

此外掛將從您自己的 API 金鑰中擷取 OpenWeatherMap API 的天氣資料,並顯示在小工具中。

輸入資料

您可以在小工具中顯示某個城市(輸入資料:城市名稱)或特定座標(輸入資料:緯度和經度座標)的天氣。

放置/短碼

這個天氣小工具可以在頁面、文章或小工具區域實現,並使用短碼 [weather_forecast_widget]。此外,您可以為每個短碼傳遞不同的屬性,以覆蓋此小工具放置的設定(例如,使用短碼屬性來管理小工具標題)。

範本

目前您可以為小工具選擇 3 個範本。
* 範本1
* 當天天氣和未來 3 天的天氣預報
* 範本2
* 範本2 使用 Bootstrap!
* 當天天氣和未來 3 天的小時天氣預報和天氣預報
* 範本3
* 範本3 使用 Bootstrap!
* 當天和未來 7 天的天氣,每天都有小時天氣預報和未來 3 天的天氣預報
* 警示模板1
* 警示模板1 使用 Bootstrap!
* 活躍的天氣警示

背景圖像

對於此小工具,您可以選擇自己的背景圖像。您可以在小工具設置中設置靜態背景圖像,或者選擇動態變體(在放置短碼的頁面/文章中使用的縮略圖)作為背景圖像。

天氣數據

除了每日天氣預報之外,此小工具還可以顯示小時天氣預報。這些預報可收起。

天氣警示

此小工具也會顯示天氣警示。這些警示可以關閉。

天氣圖示

您可以在小工具中找到美觀的天氣圖示。在插件的設置頁面中,您可以選擇要在小工具中使用的天氣圖示。
* 動畫圖示(填充)
* 靜止圖示

懶加載

您可以使用懶加載(ajax)加載小工具,只有當有必要時才會加載數據。

快取

現在快取是一個重要的話題。此天氣預報小工具使快取接收的天氣數據,以供下一個訪客訪問您的網站頁面/文章時使用。您可以在設置中設定所需的快取時間(快取時間最長可達 1 小時,以確保小工具中的天氣數據盡可能更新)。此快取功能還可以節省 API 呼叫。

短碼示例

為城市擷取天氣資料

[weather_forecast_widget city=”Kufstein”]

為城市擷取天氣資料並將城市名稱顯示為標題文本

[weather_forecast_widget city=”Kufstein” title_cityname=”X”]

為特定座標擷取天氣資料

[weather_forecast_widget lat=”47.5824″ lon=”12.1627″]

為特定座標擷取天氣資料並將 “天氣小工具的天氣” 顯示為標題文本

[weather_forecast_widget lat=”47.5824″ lon=”12.1627″ title_overwrite=”天氣小工具的天氣”]

懶加載擷取天氣資料

外掛標籤

開發者團隊

⬇ 下載最新版 (v1.1.7) 或搜尋安裝

① 下載 ZIP → 後台「外掛 › 安裝外掛 › 上傳外掛」
② 後台搜尋「Weather Forecast Widget」→ 直接安裝(推薦)
📦 歷史版本下載

原文外掛簡介

GENERAL
The weather data for this widget will be retrieved from the OpenWeatherMap API with your own API key.
OPENWEATHERMAP API
⚠️ Important Note: OpenWeatherMap has transitioned from version One Call API 2.5 to the new One Call API 3.0.
As of now, usage of the API is no longer possible without adding valid billing information (e.g. a credit card) to your OpenWeatherMap account – even for the free tier.
This means that the Weather Widget will not work anymore unless:
– you switch to the new One Call 3.0 API, and
– you have a valid payment method on file in your OpenWeatherMap account.
🔒 Recommendation:
To avoid unexpected charges, it is highly recommended to set a billing cap / usage limit in your OpenWeatherMap account under Billing Plans after adding a payment method.
For pricing details and limits, visit: Pricing – OpenWeatherMap
INPUT DATA
You can show the weather for a CITY (input data: city name) or for specific COORDINATES (input data: latitude & longitude coordinates) in the widget.
PLACEMENT/SHORTCODE
The weather widget can be implemented in a page, a post or into the widget area with the help of the shortcode [weather_forecast_widget]. Furthermore you´ll be able to pass different attributes to each shortcode to override your settings for this widget placement (e.g. manage widget title with an shortcode attribute).
TEMPLATES
Currently you can choose 3 templates for the widget.
* Template 1
* Current day´s weather with a weather forecast for the next 3 days
* Template 2
* Template 2 uses Bootstrap!
* Current day´s weather with an hourly weather forecast and a weather forecast for the next 3 days
* Template 3
* Template 3 uses Bootstrap!
* Weather for the current day and for the next 7 days, each with an hourly weather forecast and a weather forecast for the next 3 days
* Alert Template 1
* Alert Template 1 uses Bootstrap!
* Active weather alerts
BACKGROUND IMAGE
For this widget, you´ll be able to choose your own background image. Either you set a static background image in the widget settings or you choose the dynamic variant (thumbnail of the page/post, where the shortcode is placed) will be used as a background image.
WEATHER DATA
In addition to the daily weather forecast, an hourly weather forecast can also be displayed in the widget. Both the daily and hourly weather forecast can be collapsed.
WEATHER ALERTS
The weather widget also shows weather alerts. These alerts are dismissable.
WEATHER ICONS
In the widget you´ll find awesome and beautiful weather icons. In the plugins settings page you can choose which weather icons you want to use for the widget.
* Animated Icons Filled
* Animated Icons Not Filled
* Static Icons
LAZY LOADING
You have the possibility to load the widget with lazy loading (ajax) to load the data only when necessary.
CACHING
Nowadays caching is an important topic. This weather forecast widget makes it possible to cache the received weather data for the next visitor, who will visit your website page/post next time. You´ll be able to set your desired caching time in the settings (caching time possible up to 1 hour => this should ensure that the weather data in the widget is as current as possible). With this caching possibility you´ll also save API calls.
SHORTCODE EXAMPLES

Retrieve weather data for a city

[weather_forecast_widget city=”Kufstein”]

Retrieve weather data for a city and show city name as title text

[weather_forecast_widget city=”Kufstein” title_cityname=”X”]

Retrieve weather data for specific coordinates

[weather_forecast_widget lat=”47.5824″ lon=”12.1627″]

Retrieve weather data for specific coordinates and show “Weather for Weather Widget” as title text

[weather_forecast_widget lat=”47.5824″ lon=”12.1627″ title_overwrite=”Weather for Weather Widget”]

Retrieve weather data with lazy loading and template 3 for specific coordinates and expand the hourly and daily forecast initially

[weather_forecast_widget lazy_loading=”X” template=”3″ hourly_forecast=”show” daily_forecast=”show” lat=”47.5824″ lon=”12.1627″]

Retrieve weather alerts with lazy loading and alert template 1 for specific coordinates and expand the weather alerts initially

[weather_forecast_widget lazy_loading=”X” template=”alert_1″ alerts=”show” lat=”47.5824″ lon=”12.1627″ max_width=”500px”]

SETTINGS

Input box for your OPEN WEATHER MAP API key (the api key will be tested for validity while saving!)
Dropdown box to choose if caching of the weather data is necessary and if yes, which CACHE TIME should be used.
Media uploader/selector to choose a BACKGROUND IMAGE for the widget (optional – otherwise the page/post thumbnail will be used)
Radiobuttons to select the WIDGET TITLE TEXT, which will be displayed in the widget. This setting will be used as a default if nothing else will be passed in the shortcode. If you´ll pass title_cityname or title_overwrite as a shortcode attribute, this attribute will be processed in the widget output.
Dropdown to choose the POST META FIELD for the title text, if you selected the readio button “Post Meta Field (choose one of the dropdown below)“
Choose, which WEATHER VALUES should be shown in the widget
Choose, which UNITS should be used to display the weather values
Choose, which WEATHER ICONS should be used for the widget

TRANSLATIONS

German – adminbergtourentipptirol

Credits

Static Weather Icons provided from Erik Flowers Weather Icons
Animated Weather Icons provided from Basmilius Weather Icons

延伸相關外掛

文章
Filter
Apply Filters
Mastodon