Weather Forecast – WP Wunderground


“[WP Wunderground] is by far, the best weather plugin i’ve ever seen on a CMS before. Not even Joomla has something so powerful, good looking and yet easy to implement.”
Robson

Wunderground is the best WordPress weather site.

Wunderground.com has the most accurate and in-depth weather information. They’re also not evil corporate giants, and are weather geeks, which is nice.

This plugin uses the Wunderground API to gather its accurate forecasts.

If you want a great-looking weather forecast, use this plugin.

This is the best-looking weather forecast plugin for WordPress. It looks great on many different templates out of the box, including the default WP theme, TwentyTen.

Why would I want this plugin?

This plugin is a perfect compliment for regional websites (about a city or town), personal websites where you want to share what the weather is like where you’re blogging from, travel sites (show the weather at each stop!), snow removal websites, yard services websites, and more.

The WP Wunderground plugin uses 10 great-looking icon sets from Wunderground.com, including:

Check out the Screenshots section for pictures.

Using the WP Wunderground Weather Plugin

The plugin can be configured in two ways:

  1. Configure the plugin in the admin’s WP Wunderground settings page, then add [forecast] to your content where you want the forecast to appear.
  2. Go crazy with the [forecast] shortcode.

Using the `[forecast]` Shortcode

If you’re a maniac for shortcodes, and you want all control all the time, this is a good way to use it.

[forecast location="Tokyo, Japan" caption="Weather for Tokyo" measurement='F' todaylabel="Today" datelabel="date('m/d/Y')" highlow='%%high%%°/%%low%%°' numdays="3" iconset="Cartoon" class="css_table_class"]

The shortcode supports the following settings:

  • location="Tokyo, Japan" – Use any city/state combo or US/Canada ZIP code
  • caption="Weather for Tokyo" – Add a caption to your table (it’s like a title)
  • measurement='F' – Choose Fahrenheit or Celsius by using “F” or “C”
  • datelabel="date('m/d/Y')" – Format the way the days display (“9/30/2012″ in this example)
  • todaylabel="Today" – Format how today’s date appears (“Today” in this example)
  • highlow='%%high%%°/%%low%%°' – Format how the highs & low temps display (“85°/35°” in this example)
  • numdays=3 – Change the number of days displayed in the forecast. Up to 6 day forecast.
  • iconset="Cartoon" – Choose your iconset from one of 10 great options
  • class="css_table_class" – Change the CSS class of the generated forecast table

Learn more on the official plugin page

Screenshots

  1. wunderground screenshot 1

    Embedded in content in the twentyten theme

  2. wunderground screenshot 2

    Embedded in content in the twentyten theme, alternate settings

  3. wunderground screenshot 3

    In the sidebar of the Motion theme

  4. wunderground screenshot 4

    In the sidebar of the ChocoTheme theme

  5. wunderground screenshot 5

    In the sidebar of the Piano Black theme

  6. wunderground screenshot 6

    In the sidebar of the twentyten theme

  7. wunderground screenshot 7

    Plugin configuration page

Installation

  1. Upload plugin files to your plugins folder, or install using WordPress’ built-in Add New Plugin installer
  2. Activate the plugin
  3. Go to the plugin settings page (under Settings > WP Wunderground)
  4. Configure the settings on the page. (Instructions for some setting configurations are on the box to the right)
  5. Click Save Changes.
  6. When editing posts, use the [forecast] “shortcode” as described on this plugin’s Description tab

FAQ

Q. How do I use my own icons?
A. If you want to use your own icons, you would add a filter to the bottom of your theme’s functions.php file:

Version 1.2+

add_filter('wp_wunderground_forecast_icon', 'use_custom_wunderground_icons');

function use_custom_wunderground_icons($content=null) { 
    
    $myIconFolder = 'http://www.example.com/images/';
    
    $myFileType = '.gif';
    
    $content = preg_replace('/http://icons-ecast.wxug.com/i/c/[a-z]/(.*?).gif/ism', $myIconFolder.'$1'.$myFileType, $content);
    
    return $content;
}

Version 1.1

add_filter('wp_wunderground_forecast', 'use_custom_wunderground_icons');

function use_custom_wunderground_icons($content=null) { 
    
    $myIconFolder = 'http://www.example.com/images/';
    
    $myFileType = '.gif';
    
    $content = preg_replace('/http://icons-ecast.wxug.com/i/c/[a-z]/(.*?).gif/ism', $myIconFolder.'$1'.$myFileType, $content);
    
    return $content;
}

Q. I am unable to activate the plugin.
A. This plugin requires PHP5, and Version 1.0 does not check for PHP compatibility. In future versions, it will show a more meaningful error and also support PHP 4.

For now, however, options are to upgrade the version of PHP (contact your web host) or to not use the plugin.

Q. I want to modify the forecast output. How do I do that?
A.

function replace_weather($content) {
    $content = str_replace('Rain', 'RAYNNNNN!', $content);
    $content = str_replace('Snow', 'SNNNOOOO!', $content);
    return $content;
}
add_filter('wp_wunderground_forecast', 'replace_weather');

Q. What is the plugin license?
A.

  • This plugin is released under a GPL license.

Q. Do I need a Wunderground account?
A. Nope, no account needed.

Q. This plugin slows down my site.
A. Version 1.1 of the plugin added forecast caching, so the forecast is only re-loaded every 6 hours.

For previous versions, it is recommended to use a caching plugin (such as WP Super Cache) with this plugin; that way the forecast isn’t re-loaded every page load.

Changelog

1.2.5.1

  • Quick fix for icon issues: the icon images were broken.

1.2.5

1.2.4

  • Removed error generation when XML file cannot be read (Error on line 427, as reported). Now, it just outputs an HTML comment error message.

1.2.3

  • Fixed bug where Degree Measurement select drop-down would not show saved state as Celsius, even though it was working properly. (thanks Robson)
  • Added proper HTML escaping for High/Low formatting and temperature output

1.2.2

  • Added GoDaddy compatibility by switching from simplexml_load_file to wp_remote_fopen and simplexml_load_string (thanks, rjune)

1.2.1

  • Fixed issue with “Give thanks” link

1.2

  • Improved data storage, fixing issues users were having with Celsius / Fahrenheit settings and setting the number of columns in a table
  • A new cache option has been added to the shortcode. Add cache=0 or cache= to the shortcode to disable storing forecasts. Not recommended; will dramatically slow down site.
    • If you want to refresh the results, you can add ?cache=false to your URL and the forecast will be updated.
  • Added “width” option to shortcode to define table width. 100% is the default. Use width=0 or width= to disable hard-coding width in table.
  • Changed the default high/low setting to add the degree symbol.
  • Removed code whitespace when storing table for added speed
  • Added CSS classes to forecast columns based on weather conditions. This will allow you to make “Partly Cloudy” columns gray, “Sunny” blue, etc.
  • Added three new filters:
    • wp_wunderground_forecast_cache – How long results are cached for. Default: 6 hours.
    • wp_wunderground_forecast_icon
    • wp_wunderground_forecast_conditions
    • wp_wunderground_forecast_temp
  • Rounded column width to two digits. Instead of 16.66666667%, it’s now 16.67%

1.1

  • Added data storage – the plugin will now store forecast tables for 6 hours. This should speed up the time it takes to load the forecasts.
  • Added a check for PHP5 and simplexml_load_file, which are required for the plugin.

1.0

  • Initial launch

Downloads Stats

[plugin-stats size="500x300" add-link="1"]