Title: Weather Widget
Author: sk33t
Published: <strong>2008 年 3 月 26 日</strong>
Last modified: 2009 年 7 月 16 日

---

搜尋外掛

這個外掛**並未在最新的 3 個 WordPress 主要版本上進行測試**。開發者可能不再對這個
外掛進行維護或提供技術支援，並可能會與更新版本的 WordPress 產生使用上的相容性問題。

![](https://s.w.org/plugins/geopattern-icon/weather-widget.svg)

# Weather Widget

 由 [sk33t](https://profiles.wordpress.org/sk33t/) 開發

[下載](https://downloads.wordpress.org/plugin/weather-widget.zip)

 * [詳細資料](https://tw.wordpress.org/plugins/weather-widget/#description)
 * [使用者評論](https://tw.wordpress.org/plugins/weather-widget/#reviews)
 *  [安裝方式](https://tw.wordpress.org/plugins/weather-widget/#installation)
 * [開發資訊](https://tw.wordpress.org/plugins/weather-widget/#developers)

 [技術支援](https://wordpress.org/support/plugin/weather-widget/)

## 外掛說明

#### Requirements

 * WordPress 2.2 or 2.0.x/2.1.x with WordPress Widgets
 * PHP 4.3.0 or greater (needed for function file_get_contents)

#### Location

The location can either be a zip code for US users or the locid. To find the locid,
you can do a search using http://xoap.weather.com/search/search?where=[search parameters].
This will return an XML file with search results and their corresponding locid’s.

You can also find it using the Weather.com website. After searching for and selecting
your city, you will be sent to a url that will look something like, http://www.weather.
com/outlook/driving/interstate/local/USTX0617?from=search_city, where USTX0617 is
the locid.

#### Image Hosting

I’ve provided the images used and provided by weather.com [here](http://nothingoutoftheordinary.com/weatherimages.tar.gz).
If you want to host your own images, extract and upload the files, then, in the 
admin panel, edit the ‘Image Location’ field to point to your directory of images.
Make sure to have the trailing slash.

If you don’t use your own images, you are free to use the ones that I’ve hosted,
which are located at http://nothingoutoftheordinary.com/weatherimages/

### Formatting

You can edit ‘Widget Formatting’ to change how the info is displayed. To access 
the variables, use this formatting:

 * %loc% – Location
 * %temp% – Current temperature
 * %feels% – Feels like temperature
 * %icon% – The icon referring to the current weather. This is just a number
 * %iconhref% – The location of the image with your set image location at the front
 * %attribution% – The link supposedly required to be displayed. Weather data provided
   by weather.com®

The default formatting is:

<img src=”%iconhref%” alt=”%cond%” style=”float:right;” />
 %loc%<br /> <span style
=”font-size: 150%;”>%temp% °F</span> (%feels% °F)<br /> <span style=”font-size: 
65%; float: right;”>%attribution%</a>

## 螢幕擷圖

 * [[
 * Default Display
 * [[
 * Admin Panel

## 安裝方式

 1. Download weather-widget.zip
 2. Extract and upload weather.php to the plugins/ directory
 3. Enable Weather Widget in the Plugin admin panel
 4. In widget admin panel, place Weather in the sidebar, and edit it to enter your 
    location

## 常見問題集

  Nothing shows up when I try it or I get an error that file_get_contents doesn’t
exist

This script relies on the function file_get_contents to fetch the RSS feed. If your
host doesn’t allow the use of it, but allows the use of curl, you can replace

    ```
    $stories = file_get_contents($uri);
    ```

with

    ```
    $ch = curl_init();
    $timeout = 5; // set to zero for no timeout
    curl_setopt ($ch, CURLOPT_URL, $uri);
    curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
    curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
    $stories = curl_exec($ch);
    curl_close($ch);
    ```

  What does cache time mean?

It’s the number of seconds before the content will be requested again. You can set
this to be 0 or -1 to not use the caching system. If you edit any of the widgets
in the widget admin panel, the cache is cleared.

## 使用者評論

這個外掛目前沒有任何使用者評論。

## 參與者及開發者

以下人員參與了開源軟體〈Weather Widget〉的開發相關工作。

參與者

 *   [ sk33t ](https://profiles.wordpress.org/sk33t/)

[將〈Weather Widget〉外掛本地化為台灣繁體中文版](https://translate.wordpress.org/projects/wp-plugins/weather-widget)

### 對開發相關資訊感興趣？

任何人均可[瀏覽程式碼](https://plugins.trac.wordpress.org/browser/weather-widget/)、
查看 [SVN 存放庫](https://plugins.svn.wordpress.org/weather-widget/)，或透過 [RSS](https://plugins.trac.wordpress.org/log/weather-widget/?limit=100&mode=stop_on_copy&format=rss)
訂閱[開發記錄](https://plugins.trac.wordpress.org/log/weather-widget/)。

## 中繼資料

 *  版本 **1.6**
 *  最後更新 **17 年前**
 *  啟用安裝數 **90+**
 *  WordPress 版本需求 ** 2.0.2 或更新版本 **
 *  已測試相容的 WordPress 版本 **2.8.1**
 *  語言
 * [English (US)](https://wordpress.org/plugins/weather-widget/)
 * 標籤:
 * [weather](https://tw.wordpress.org/plugins/tags/weather/)[weather.com](https://tw.wordpress.org/plugins/tags/weather-com/)
   [widget](https://tw.wordpress.org/plugins/tags/widget/)
 *  [進階檢視](https://tw.wordpress.org/plugins/weather-widget/advanced/)

## 評分

這個項目尚無任何評論記錄。

[Your review](https://wordpress.org/support/plugin/weather-widget/reviews/#new-post)

[查看全部使用者評論](https://wordpress.org/support/plugin/weather-widget/reviews/)

## 參與者

 *   [ sk33t ](https://profiles.wordpress.org/sk33t/)

## 技術支援

使用者可在技術支援論壇提出意見反應或使用問題。

 [檢視技術支援論壇](https://wordpress.org/support/plugin/weather-widget/)

## 贊助

想要支援這個外掛的發展嗎？

 [ 贊助這個外掛 ](http://ja.meswilson.com/blog/)