Weather Widget
UPDATE: Corrected output to meet WC3 XHTML 1.0 Transitional Standards
I thought I would take a shot at creating a Widget to display the standard wunderground.com weather sticker. I could have used the built in Text Widget to add the needed code to display their weather sticker, but whats the fun in that. After checking out the provided samples and a few minutes of cursing, I managed to get my widget to work. Unfortunately for my foreign friends, the weather widget only allows you to enter US locations.
To install the weather widget:
Just upload wunder.php into the wp-content/plugins/widgets directory, activate the module from the Plugin Management page, and then go to the Sidebar Widgets page to configure your Title, City and State.
Configuration Example

April 20th, 2006 at 4:59 am
[...] This Weather Widget displays your local weather from wunderground.com. [...]
April 20th, 2006 at 8:57 pm
Hi. I entered my info and it says “city not found”. Any ideas–I live in a state capitol, so hopefully wunderground has heard of it…
April 20th, 2006 at 10:16 pm
Hi jivyb,
It should work fine for your location. Are you entering the entire state name or the abbreviation? It will only work if you use the abbreviation, for example use TX not Texas.
April 20th, 2006 at 10:36 pm
Cool widget!
April 21st, 2006 at 11:58 am
I had the zip code instead of the state abbreviation. So I changed it but now it just displays the title and nothing else. I know this can’t be that complicated!
April 25th, 2006 at 10:38 pm
Hiya,
I’ve installed his Widget on my Blog, and although the Widget works, it doesn’t seem to find my town.
If I visit the Wunderground.com website and search for Wolverhampton (my town), it finds it.
But unfortunately, on the Widget it doesn’t.
Do I have to be a US resident and therefore have to enter a US zipcode? I live in the UK.
Kind Regards,
Parm
May 5th, 2006 at 12:06 am
I’m just repeating what people are saying. The widget is installed fine but it says “Error. City Not Found.’
May 5th, 2006 at 3:10 am
Hi Parm,
Sorry but this does not work for locations outside of the US. wunderground.com uses the city/state format for US locations only and all other locatiuons are based on station numbers. I created this for a friend that uses the wunderground.com sticker on his blog and wanted to switch to widgets. This widget was just so I could check out how widgets worked and make a friend happy. I realize it may not work for everyone but I thought I would share it anyway. To be honest there are several excellent weather plugins available that will be widgets soon. You may want to take a look at WeatherIcon as the creator says there is a widget in the works.
May 5th, 2006 at 3:18 am
Hi Eric,
If you post your city and state I can try to assist you as I can’t see what the issue is without that information.
May 20th, 2006 at 9:04 am
[...] Weather Sticker. From DropDeadDick. (I’m not sure if that means the guy is a jerk, or if it’s just a nickname.) I might be switching to a different weather widget, because this one doesn’t work perfectly and is causing some validation problems for me, but it does work as far as the web page is concerned, so I might just leave it be. Just gives you the temperature and conditions for Seattle. [...]
June 13th, 2006 at 11:19 pm
Hello!
I too am having problems getting this to work. I’m getting the “Error: city not found” as well. I live in Sacramento, CA and have tried about 10 different zip codes and get the same thing. The kicker is that if you click on the error, it takes directly to the weather for my city on wunderground. To make matters worse, my husband has this same widget on his blog page and it works perfectly.
The guy that does the WeatherIcon has yet to release a widget version either…
June 14th, 2006 at 11:52 am
Hi FireDancer,
It seems your error is related to my wording and I will change that.
Please enter the following and this should work for you.
City: Sacramento
State Postal Code: CA
June 16th, 2006 at 10:04 pm
Hooray! It works! Now, how it’s working on my husband’s site with the zip code in the ’state postal code’ field is another story.
Sorry for being such a noob.
June 23rd, 2006 at 2:56 am
I have changed it a little, so this one you can use for european cities. All you have to do is get the station number of the city on the wonderground.com side first. You can see the station number in der navigation bar when you are on the city side. Enter this number in the widget, that’s it.
You can get this widget here: http://www.rodehacke.ch/Blog/wp-includes/images/images/wunder.zip
June 23rd, 2006 at 7:17 am
The Link above will not work any longer. I have a small update. I have an english and a german version now. It’s your choice.
http://www.rodehacke.ch/Blog/wp-includes/images/images/wunder_en.zip
http://www.rodehacke.ch/Blog/wp-includes/images/images/wunder_de.zip
August 28th, 2006 at 7:49 pm
[...] dropdeaddick.com » Blog Archive » Weather Widget (tags: wordpress) [...]
September 9th, 2006 at 3:56 am
Thank “Itep Edor”, you change so is perfec for cities of Mexico.
Saludos Calurosos desde la ciudad de Mexicali, Baja California.
Gracias de Nuevo eres muy amable.
October 5th, 2006 at 2:42 am
I installed this and set it up properly with the town:
Hilton Head Island
State: SC
I get error city not found even though I can click on the image and get the correct weather for my area, what’s going on?
October 6th, 2006 at 12:34 pm
Hi timmers,
This has been corrected, just grab the latest version and install.
December 5th, 2006 at 4:30 pm
[...] On the particular Page titled “About”, the “Links”, “Meta” and a custom Weather widget will appear in the About sidebar. [...]
December 6th, 2006 at 2:40 am
[...] December 5, 2006Weather-Widgets for Wordpress Nach intensiver Suche habe ich endlich ein passendes Wetter-Plugin für mein Blog entdeckt. Die Installation erfolgte mit der Widgets-Funktion einfach und problemlos. [...]
January 25th, 2007 at 8:17 am
I’m also having some problems with “Error. City Not Found”, but I’ll give it an other shot tomorrow and we’ll see if I can get it to work. Anyhow, great idea for a widget! Thanks
February 21st, 2007 at 12:58 am
Thanks for an elegant implementation of a weather widget.
I’m not having any problem getting the sticker to display. But I do have one odd issue - the time display for the sticker is off by an hour. I’ve checked, and my time zone is set correctly in the WordPress General Options. Is there a way to fix that localization issue?
March 2nd, 2007 at 1:43 am
Thank you it works great! Any thoughts of intelecast widget? I use a desktop feature from them that displays a small realtime map.
June 16th, 2007 at 2:50 am
Hi, I’m a bit of a n00b to wordpress and I uploaded php file, activated it, but it does not show up anywhere on my site.
July 13th, 2007 at 5:35 pm
I don’t find my city…Dijon, in france :s
Sbdy can help me ?
July 15th, 2007 at 2:36 am
[...] After many hours of going through themes I finally found one I like. This theme is called Dreamy 1.1. If you haven’t noticed I also started playing with some Widgets like the Weather one I got going on down toward the bottom along with Last.fm. [...]
July 27th, 2007 at 5:52 am
I’m using your weather widget in my left sidebar with a black background. Can you advise on what code to add/change to make the font color of the widget text white? I had no installation troubles but the black text on black background defeats the purpose. Appreciate any help!