WeatherIcon

WeatherIcon v3 is currently in development. If you’d like to download it and help out by testing it, you can find a link in this blog post.

WeatherIcon (original site here) was originally developed by Jeremiah Poling and Garett Harnish. They deserve 99.9% of the credit for this plugin, I just added a little bit of code. Garett is also still actively working on this plugin and much of the code available in these new versions is from him.

Lastest Version:

  • Version 2.3.2 (March 3rd, 2006) [Download]

Description:

WeatherIcon is a WordPress plugin that will display the current weather for a specified location. Look to your right to see it in work — it’s displaying my current weather. (The location text, current day & time, and “powered by” is part of my WordPress theme, not part of the plugin.)

The plugin fetches it’s data from the NOAA website and caches it for the time that you specify in the WeatherIcon options panel. You also configure what items you want to display. Here is a list of all of the items that you can display:

  • An icon like the one to the right that changes to match the weather and for daylight / nighttime
  • Temperature
  • Humidity
  • Wind
  • Dew Point
  • Visibility
  • Clouds
  • Barometer
  • Wind Chill
  • Heat Index
  • Sunrise
  • Sunset

You also get to choose from Fahrenheit or Celsius for the temperature, miles or kilometers for the visibility, and 4 different units for the wind speed.

Support / Feature Request Forums:

http://www.viper007bond.com/wordpress-plugins/forums/

WP-Dash Widget Screenshot:

Note that the widgets will display whatever data you want and resize automatically, not just what’s shown in the examples below.

WeatherIcon WP-Dash Widget Screenshot

Requirements:

  • WordPress v1.5+ (yes, this plugin works fine in WordPress v2.x)
  • WP-Dashoptional, but required to get weather on your dashboard like in the above screenshot

Download Latest:

  • Version 3.0.0 Beta — Suggested download even though it’s not a finalized version (runs well, lots more features, and is much less buggy)
  • Version 2.3.2 — Released on March 3rd, 2006 (just a small bugfix)

Make sure to read the included readme, especially if upgrading from a version older than v2.1.0! :)

Download Old Versions:

Just kept for archival purposes. Not advised for use unless you have to for some reason.

Can I use this script on a non-WordPress powered site?

No, not out of the box. It’s a WordPress plugin and it uses many, many WordPress functions to store it’s options and such. However, the METAR processing class in version 3 (it’s what processes the data retrieved from NOAA) is WordPress independent I believe, so that may be a good starting point if you wish to go that route.

198 Comments On This Page

  1. Thank you, m’friend! Downloading right now, will let you know how it goes….

  2. Great work. Works wonderfully.

  3. Version 2.2.0 released! :)

  4. My blog “Jennys blogg” is not a danish site it is a swedish site! Is there a meta tag or something in my blog that wrongly says it is danish?

    In your comment in my blog you said I could make it show in my langugae but the Swedish language is not available in the general options. There is only: deutsch, english, francais, chinese and spanish.

    But it is a good plugin! :)

  5. The flag plugin here runs off an IP database and my best guess is that either your server or the company that owns the IP address is located in Denmark. :/

    As for your getting WeatherIcon in your language, check out this page as it applies to WeatherIcon as well: http://codex.wordpress.org/Translating_WordPress

    Basically, you open up the template file in the WeatherIcon language folder with poEdit or another .mo/.po software, translate what you want into Swedish, and then save it as a new file.

    If you do end up translating the WeatherIcon language file, let me know and I’ll bundle it with the WeatherIcon download for others.

    Oh, and nice site by the way. Looks good. :)

  6. There is no (Options) -> WeatherIcon in my WP, guess it’s because my language isn’t English.
    I can edit the php no problem, just letting you know :)

  7. Please disregard my post, user error I guess :)

  8. Hello….

    Could i use this plugin in other PHP Blog Program?

    if it is possible,how to?

    Thank you very much!

  9. Re: Robbie Liu

    Not easily. It uses core WordPress functions to store it’s options as well as to create the options page.

    However, if you are good with PHP, it wouldn’t be that hard to rip out the part of the script that fetches the weather from the NOAA site and with a some manual configuration (i.e. manually setting the details that are set on the options page and setting up a fake language handling function), I bet it could be turned into a stand-alone script.

  10. Re: Class

    So you got it working alright?

  11. hello

    I modified the “WeatherIcon.php” like this

    and in my index.php
    add “require_once ([path_to_the_dir]/WeatherIcon.php)”

    but how to modify my template “index.htm” to show the data?

    i don’t know PHP and WP much…

    Thank you very much!

  12. That file looks good except for WordPress’ language function,” __(’text here’);”. Just make a dummy function:

    < ?php function __($text) { return $text; } ?>

    As for how to get the weather, you just need to call the WeatherIcon function:

    < ?php WeatherIcon('station=XXXX'); ?>

    Just replace the station code with your own station code: http://weather.gov/tg/siteloc.shtml

    However, you may have some problems with no settings for what to display. You’ll probably have to define those manually to get anything to show up.

  13. hello

    i think i’ve got the problem you said. There is no Output on my page except the location name.

    Need Help…

    Create an HTML output by these option?

    'fetch_suns',
    'display_icon',
    'display_temp',
    'display_humidity',
    'display_wind',
    'display_dewpt',
    'display_visibility',
    'display_clouds',
    'display_barometer',
    'display_windchill',
    'display_heatindex'

  14. I think they are transferred into an array from the WordPress settings table, so just replace that code with some that manually defines them.

  15. Could we have an MSN Chat?

    mine is nerdstyle#msn.com

    Thank you very much…i am really interested in it….

  16. Robbie Liu said:

    Garett on August 12th, 2005 at 6:32 PM wrote:

    Create an HTML output by these option? {list of variables}

    Viper007Bond said:

    Garett on August 12th, 2005 at 6:32 PM wrote:

    I think they are transferred into an array from the WordPress settings table

    Yes and No. Technically $weather_default_options saves itself into the database if there are not values there (usually 1st load), then it later retrieves the values. So yes, the array values are stored in a database. Do they have to be, does it require a database? No.

    Near the top, the defaults are defined. To remove the configuration page, rename them both and delete the database retrieval/set lines. Rename $weather_default_settings to $weather_settings and $weather_default_options to $weather_options and delete the lines which retrieve and set both $weather_settings and $weather_options from the database. To add new display options, just add a new line into the array with their name ie: ‘display_temp’ or to remove the the name from the array to drop the display for it.

    Am I clear or am I muddling things? To be honest, it would be a lot easier to get the plugin working from version 1 line of the plugin, which is still available on Jeremiah’s blog.

  17. Mmm, good idea. That never occured to me.

  18. Version 2.3.0 released! :)

  19. Thanks!

  20. Uhm…it don rule anyway….sooner it appears “Weather data not avalaible”, but now only apears the city…and no image and no data with the new version…cache CHMOD is 777 and all I think is fine… >_

  21. Do you have any of the display option checkboxes checked on the WeatherIcon options page? Double check that you do.

  22. Nothing…all is the same….uhm, please send me a mail if you want to Milleiro@Yahoo.es , so we can continue talking about that via e-mail.
    Thanks

  23. The main question is what type of caching are you using. There may be bugs in the database caching (since it’s a new feature). I personally didn’t encounter them, but they could exist.

    The first thing I should state is if you’re having a problem, we need the debugging information. From that, we can recreate the problem and track down what is going wrong. The problem is the debugging data is a little long and will usually mess up one’s page. We should probably include some code to use in debugging. Hmm, create a page entitled ‘wctest.php’ in your web root with the following code inside:

    [php]< ?php
    define('WP_USE_THEMES', false);
    require('./wp-blog-header.php');
    WeatherIcon("station=CYQR&debug=true&before=&after=
    &”);
    ?>[/php]

    Make sure you chmod 644 it, change the station to your airport code, and then load it in the webpage (http://myblog.com/wctest.php). Then either post the output here, in this forum, or send them to Viper007Bond or me.

    Since you are getting “Weather Data Not Available,” it could be a problem in processing the METAR data or a damaged cache file. The debugging output should make it easier to figure out. Either way, we’ll have the METAR.

  24. *cough*
    Due to forgetting to put strtoupper() on lines 531/2, correct the WeatherIcon call line to:

    WeatherIcon("station=CYQR&debug=TRUE&before=&after=&");

  25. I didn’t use $debug === 'TRUE', did I? == should match both ‘TRUE’ and ‘true’, or so I thought.

  26. Parse error: parse error in /data/members/free/tripod/es/a/n/d/andresitoh/htdocs/wctest.php on line 3

  27. Parse error: parse error in /data/members/free/tripod/es/a/n/d/andresitoh/htdocs/wctest.php on line 3

    and my wctest.php file is:

  28. Oh sorry, wait, cos I dont change the station…

  29. The same error…parse error on line 3

  30. The file has to be in the root wordpress directory, or you have to change the “require” line to find wordpress’ wp-blog-header.php. The other option is wordpress translates quotes so if you just copied and pasted them, your quotes aren’t actually quotes. Replace ‘em.

  31. Garett on August 24th, 2005 at 11:44 AM wrote:

    I didn’t use $debug === ‘TRUE’, did I? == should match both ‘TRUE’ and ‘true’, or so I thought.

    That’s only true if $debug is boolean, which it isn’t. We assign it a boolean value, but it’s a string after we clip it out of the argument list (thus case sensitive). strtoupper is an easy fix.

    I also have some addition bug fixes. There is a bug in no_night which causes WeatherIcon to try to display night icons for conditions that don’t have night icons (since the bug is my fault, it’s only right that I fix it … I still don’t understand why it didn’t work the other way but _shrug_ it must have to do with the or condition … stupid if condition processing).

    Also, a guy on Jeremiah’s blog encountered a code in his METAR data that I’d never seen before (and I found out what it means). In sky conditions, he had NSC which means No Significant Clouds (It’s mentioned as a footnote in the FAA Metar information). I have a fix for it too (it’s posted in Jeremiah’s blog if anyone’s interested).

    We should probably roll them out as 2.3.1 (or something).

  32. Andres: Actually, why don’t you copy the code from my own version. If you scroll down, you should see a section entitled “Code”, just copy what is below that and you should have everything you need. It is working with my current version of WordPress (which has the strtoupper fix on lines 531/532 so if you may have to change debug=true to debug=TRUE). At the moment it defaults to CYQR if not AC is passed to the script. You can pass different AC codes like so: wctest.php?AC=KPDX … or you could change the hardcoded default to your airport code.

    If you really want, you could just use my script.

  33. Buf…I think that something better..you can check it here:
    http://usuarios.lycos.es/andresitoh/wctest.php

    But the weather isn’t appearing… please explain better ‘cos I dont understand you too much…sorry

  34. Okay, I’ve set up some forums as to not make these comments absurbley long. All support questions and feature requests should now go here:

    http://www.viper007bond.com/wordpress-plugins/forums/

    “Thanks for the plugin” and comments like that should continue to be posted here.

  35. Andres: We will continue on this post in the forum.

  36. This might be silly but i want to remove this » in front of the icon. Where can i do that?

  37. We have support forums you know. ;) Anyway, I use this personally:

    [php]WeatherIcon(”station=KPDX&before=&after=
    \n”);[/php]

    Instead of outputting each item in a list, it just simply places a line break after each item.

    However, if you really are looking to have the other items (temp, clouds, etc.) still be outputted in a list while not having the icon be in the list, that’s currently not possible without editing the plugin’s code. If this is in fact what you’re looking for, please post a request for this feature. :)

  38. Halo,
    I would like to commment that this plugin is very nice. But I have problem … I have install it to my blog. I use WP for my blog and I want to put it on sidebar. My problem is the plugin totaly does not appear. Need your suggestion.

    thanks i.a

  39. I’ve started a support thread for you. Let’s continue the discussion there:

    http://www.viper007bond.com/wordpress-plugins/weathericon/forums/viewtopic.php?id=16

  40. I changed my icons from the default to a slate background, photo-realistic version.

    Feel free to take a peek.

    http://www.rightonblog.net/

  41. Nice! I may just have to use those on my site. :o

  42. About those icons … did James leave an e-mail address? They way he phrased it, it sounds like he made those icons himself. If so, we should ask for his permission to use them as the default and/or optional icons in the next release (2.3.1)?

  43. He and I IMed each other and gave me a ZIP of them.

    You’re right though that I need to make sure he’s the one who made them and that he didn’t just gank them from somewhere. I’ll get on it.

  44. How can I get rid off these “dots” infront of every output? ?

  45. Viper007Bond on October 13th, 2005 at 3:18 PM wrote:

    Null on October 13th, 2005 at 10:38 AM said:

    How can I get rid off these “dots” infront of every output? ?

    Don’t output it as a list (<li>). Try this code:

    [php]WeatherIcon(”station=STATION&before=&after=
    \n”);[/php]

  46. Oke on what page and where do I have to put this code in?

    Thx

  47. Just replace what you had with what I gave you.

  48. I am sorry,
    I didn’t described very well what I ment (poor in english sorry). I only want the dot infront of the weather picture gone. So no dot infront of the .gif picture. Kinda looks weird, but I do want the dots infront of the other output. Is there a solution for this?

    Sec. In the css file you can replace the dots for an image/icon. How can I do this for this weather plugin? What code to add in the css to change this? I already have a icon for it, but i am too noob to figure out how to change it using css.

    Thank you for your time!

    Null

  49. Okay, moving to the support forums since this is more than just a quick question.

  50. it seems as though the sunrise/ sunset feature in the options page does not work outside north america. is this true? i am trying to get it to work from vietnam. perhaps i am entering incorrect numbers in the sunrise and sunset hours? my server is in the united states though.

  51. It fetches the sunrise/sunset data from WeatherUnderground.com and that site may not return any results for your location or may not have the sunrise/sunset for your location.

    Replace XXXX with your weather station:

    http://mobile.wunderground.com/cgi-bin/findweather/getForecast?brand=mobile&query=XXXX

  52. I dont know if you thought this was solved or not, but on my blog, the damn plugin is still asking for NIGHT icons that dont exist, such as n_4cloud_modrain.gif. I am not sure how to make it stop, but I have picked up the most recent version of the plugin but, as of yet, had no success. Ideas? Heres the blog

  53. Why not MAKE the images it is looking for by duplicating some and renaming them?

  54. Not a bad idea, not a bad idea at all. Still, its a bug that I think needs some attention.

  55. Yeah, version 3 is in the works. We’ll make sure to add checking to make sure that the icon exists and if not, just display nothing or something.

  56. Hi great plugin, have just uppgraded to 2.3 and are really happy about the option to automaticly get sunset and sunrise hours as I want to display the weather both in Sweden and Australia and I was wondering how to adjust for the time difference.

    The plugin recieves the times but somewhere converts the Australian time wrong (my server is in sweden) It tries to display the Australian sunset and sunrise times in western European Standard Time (I assume to understand when in european/server time to say that it’s day/night in Aus) but instead of removing 10h from the Aus time it adds 6h, have tried to look trough the .php file to find the problem but are a bit limited in my knowledge. It’s also a bit tricky as when daylight savings change the time difference changes to 8h (I have fixed that in my clock setting thought by this function):

    $summertime = date(’I');
    if ($summertime == 0) {
    $hourdiff = 10;}
    else {
    $hourdiff = 8;}

    Would be greatful for help with this Issue

    Cheers /Jakob

  57. By the way, if it helps here are the weather stations I wish to show:

    Gothenburg, Sweden: ESGG
    Melbourne, Australia: YMML

    My page is still under construction so it is not online yet (iis5.1 on my computer php5 and MySQL5)

    Thanks in advance /jakob

  58. Jakob - I’ve started a thread for you in our support forums. We’ll continue this there as I don’t wanna clog up these comments. ;)

    http://www.viper007bond.com/wordpress-plugins/forums/viewtopic.php?id=42

  59. Oh, and locking these comments. All of the comments here are really just support questions and it’s best/easier to keep those to the forums.

    So, if you have a question now, ask here: http://www.viper007bond.com/wordpress-plugins/forums/

Sorry, but the comments are closed on this page and therefore you cannot reply.

Discussion Elsewhere