WP SimpleWeather Plugin

Today I released my first WordPress Plugin to the WordPress Plugin Repository. It can be found here. I have also created a page here on my website explaining the basics of the WP SimpleWeather Plugin.

As this is my blog, let me go a bit more in depth here. As I briefly mentioned above, this is the first WordPress Plugin I have created. I suppose that could lead to a variety of questions concerning it, so let me go ahead and hold a brief question and answer session with myself to explain.

Q: This is your first WordPress plugin? Does that mean it’s going to suck?

A: Yes, this is my first WordPress plugin. I mean, I’ve used plenty before, but this is the first one I have made. I suppose it is quite possible that it will indeed suck. I mean, I don’t think it does, but it is possible that users of the plugin will find any number of issues that I have not thought of. I am new to the game here, so be gentle. I will do my best to fix any issues as soon as possible.

Q: Why did you decide to create a WordPress plugin in the first place? Why a weather plugin? There are a ton of those!

A: Well, I have been using WordPress for quite some time in the creation of my websites. It is the most popular blogging platform in the world today. This website itself is made using WordPress. During the creation of another website (which I am still working on), I needed the use of a Weather Plugin. Unfortunately, all the WordPress plugins I came across dealing with weather were, well, not quite what I wanted. So, I went searching around and eventually came across the jQuery simpleWeather plugin. It was pretty much exactly what I was looking for. Except that it was not yet a WordPress plugin. I could use it easily as a jQuery plugin, but then my clients would not be able to easily update it via the WordPress back-end. So, I decided to convert it into a WordPress plugin.

Q: Someone else made it? And you’re taking credit? Isn’t that wrong?

A: Yes and no. The jQuery simpleWeather plugin was created by James Fleeting using the Yahoo! Weather API. There are a variety of available plugins which use the same. I really liked his, and merely converted the publicly available code into a WordPress plugin. If Mr. Fleeting would prefer that I take the plugin down, I will do so at his request. I am fully crediting his work (as you can see here), and do not wish in any way to be stealing his thunder. I sincerely hope that creating this plugin will bring both he and I more web design business in our respective locales.

If there are any questions, feel free to ask away in the comments section. I hope someone enjoys the plugin. If not, at least I’ve found it useful for myself.

39 Responses to “WP SimpleWeather Plugin”

  1. Awesome work on the WordPress plugin. Looks great. I will update the simpleWeather website with info on this wp plugin and a link to it.

  2. I’m glad to hear you like it. Thanks!

  3. is there a way to use a code to add the weather instead of the widget? As my theme doesn’t use widgets

  4. Currently, no, there is not a way to use a code to add the weather instead of the widget. I hadn’t even considered it’s use on non-widgetized themes. I will add the feature as soon as I can and add it to the plugin.

  5. Hi,
    With a precise location (Hautefage la Tour, FR) entered into Yahoo’s own Weather page, the correct info displays okay. But repeated attempts fail to display any weather info for same location with your plugin – I’m working with WP 3.01 in multisite configuration. Good luck with improvements!
    Regards,

  6. Martin47,

    I am unable to duplicate your error, although I am not testing with a multisite configuration. When you input the weather location, are you entering it as “Hautefage la Tour, FR”, or as “Hautefage la Tour, France”? When I enter the latter option, it is working for me without any problems…

    Have you tried other locations? Is the issue something to do with your multisite configuration or with the location itself?

  7. Samantha,

    I released version 0.2 today, which comes with the ability to implement the widget via shortcode. I hope you like it.

  8. I tried everything:

    The example above.

    Porto,Portugal

    Porto, Porto, Portugal

    Lisboa, Portugal

    and nothing happens!!!!

  9. Rui Macdonald,

    I’m having difficulty having any problems with this location… I tried on “Porto, Portugal”, and immediately got the correct weather. Is the problem with the location, or do you possibly not have the widget set up through the ‘Appearance’ –> ‘Widgets’ page? Have you tried any other locations?

  10. I have set the widget through the Appearence / Widgtes Page, I tried everylocation and nothing is visualized…

  11. Rui Macdonald,

    Have you tried using the shortcode instead of the widget?

    What version of WordPress are you running?

  12. NO I haven’t.

    What is the shortcode?

    Srry :-(

  13. I have tried every way imaginable to get my default location to show. I have tried using Zip Code, Location even the weather id code from yahoo and none will show anything.

    My location is:
    Celina, TN USA

    Zip:
    38551

    Any help would be greatly appreciated…

  14. John,

    Sorry for the slow reply, I’ve been a bit busy the past week or two.

    My best guess would be that you don’t have the widget set up in a widgetized area on your theme. You need to make sure you click on ‘Appearance’ –> ‘Widgets’ in the admin panel, and drag the WP SimpleWeather Widget into a widgetized area in order for it to display. Alternatively, you could use the shortcode [wp-simpleweather].

    I am going to go ahead and update the WP SimpleWeather Plugin page here on my blog with the most recent installation instructions which include info on the short code. Not sure why I didn’t do that on the last version upgrade.

  15. Like simpleWeather a lot. Looks fantastic and very configurable.

    Just wondering – is there any way to show the temperature in degrees C but show windspeed and visibilty in miles / mph?

    (we have a weird mix of metric/imperial in use in the UK!)

  16. Jim, unfortunately, because of the way the Yahoo! Weather API is set up it automatically changes everything. I’m not seeing any way I could edit the plugin to allow a mix and match choice. Here is a quote from the Yahoo! Weather API page.

    “Note that choosing Celsius degree units changes all the weather units to metric, for example, wind speed will be reported as kilometers per hour and barometric pressure as millibars.”

    Sorry.

  17. Thought as much. Thanks for having a look though.

    (not knowing a lot about how plugins work, is it possible to do a local arithmetic conversion from the data returned from yahoo?)

  18. Managed it in the end through a bit of tweaking in the php.

    I set the options to Fahrenheit to get the mph and miles, then did a Fahrenheit to C calculation to get the displayed temperature.

    Math.round((5/9)*(weather.temp-32))+’° C

    Messy but it works :)

  19. Glad you were able to get it working, Jim.

  20. Hi
    Thanks for the plugin look nice. I have one wish is it possible to make it with cities as a variable. This allows me to make a page with weather reports for multiple cities.
    Thanks
    Oscar Goos

  21. I have tried the widget and the shortcode, neither shows anything? Just blank space. Is there a 3.04 compatibility issue or am I doing something wrong?

  22. Leo, there is no compatibility issue with 3.04. I’m not sure what your problem might be without more information.

  23. I tried it with another site and it worked rather well, I will try a reinstall on the problematic site.

  24. I found the issue: If I use “ashford, ct, us” for the city and then check “City” in the Location settings (without checking Region or Country), the output is blank. Might be a bug.

    The plug-in is great, thanks for the work.

  25. Hi Matt, thanks for the great work.

    My question I hope is simple. Is there a way to reduce all the fonts by one size. The theme I’m using causes some of the text to wrap.

    Thanks a bunch and congrats on the marriage!

  26. Tony,

    You should be able to edit the font-size by simply adding some CSS.

    #simpleweather-widget {font-size: 12px;}

    Or whatever you want it to be.

  27. Thanks Matt,
    I went into the wp-simpleweather-plain.css and edited the box size and some of the font sizes and it looks better.

  28. Hi! The plugin is great, but i want one more thing. How can i make a translation of wp-simpleweather on Bulgarian /my language/?
    For example: “Tomorrow’s Forecast” must be “Утрешна прогноза” ; “Mist” must be “Мъгла” ; “:Monday” must be “Понеделник” and so on. :)
    Thank for the reply in advance!

  29. Ilko,

    While I’m sure it is possible to make a translation of every weather option… because of the way I’m pulling the weather information through the Yahoo! API, it looks to be a royal pain. I would basically have to rewrite the entire plugin to put out the information differently for it to be easier to translate, and I’m simply not willing to do that at this time.

    Sorry. :(

  30. Hey. Love the flexibility of this plugin, however it writes slashes the wrong way causing my pages to not validate. Any clues as to how to remedy this? Thanks.

  31. Can you tell me please what I need to put in to make ‘Sunshine Coast, QLD, Australia work. Ive tried everything

  32. Kim,

    Sorry it’s taken me so long to reply. I’ve been rather busy lately. The answer is that Yahoo! doesn’t see Sunshine Coast, Australia as a city. However if you were to pick a city that is part of the Sunshine Coast urban area, it will work. I tested it myself using the location as ‘Caloundra, Australia’.

    Hope that helps.

  33. This looks really cool. I have a custom theme with no sidebars though, So I can;t just enable the widget in Appearance settings. I tried to paste this into my custom header file:

    But it just gets a PHP error complaining about the brackets. Am I not using the Short cut code properly?

  34. Well, it stripped out the code. Basically, I copy and pasted the shortcut code you provided in your instructions.

  35. I tried with the do_shortcode() function and it does not cause an error, but it also does not display the widget. I have WordPress 3.3

  36. Daryl, the shortcode is for use on a page or post through the WordPress backend. If you’re actually editing your header file, the easiest way to do it is to simply put a div with an id of simpleweather-widget in it. The plugin uses javascript to ‘echo’ the code into a div with that name.

    <div id="simpleweather-widget"></div>

  37. Any chance of changing km/h to m/s..?

  38. Thomas,

    Per your request, I stopped being lazy and blaming it on my new baby, and I got around to putting out an update to the plugin. This functionality exists in Version 0.2.2. Unfortunately, a mistake I made in 0.2.1 will cause everyone who updates to lose their settings, and for that I apologize ahead of time. The error has also been fixed in 0.2.2. See this blog post for more info.

  39. Thank you for the m/s functionality.

Leave a Reply