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/ 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

31 thoughts on “Weather Widget

  1. 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…

  2. 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.

  3. 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!

  4. 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

  5. I’m just repeating what people are saying. The widget is installed fine but it says “Error. City Not Found.’

  6. 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.

  7. 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…

  8. 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

  9. 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. :P

    Sorry for being such a noob. :)

  10. 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?

  11. 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

  12. 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?

  13. 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!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>