NeutralAxisTwitter

Let It Snow Plugin Mods

by on Dec.24, 2009, under Blogging
Visited 800 times, 1 so far today

The Let It Snow plugin for WordPress is a nice little plugin to add a snowfall effect.  The snow falls just a tad faster than I’d like, even on its slowest setting, but what they heck.  I thought it would be nice if it was triggered by date, so its not necessary to remember to turn it off.  Snowfall in June would look weird, at least in this part of the world.  Adding a date trigger wasn’t hard.  [Update: Added another mod so that on New Years Eve, the snow flakes are colored like confetti.  And also discovered that snowfall still shows on the simplified WPTouch formatted site on iPhone.]

[Updated again to move the start/stop date and confetti options into the settings page so they can be more easily changed.  To post those changes, I'd basically need to just provide the files.  I'll do that if I hear back from the plugin author that its OK.]

Two lines near the end of the plugin’s snow.php file was all it took.  Locate the add_action(‘wp_head’, ‘let_it_snow’); line at the bottom of the file and add the following two lines before it.  This one will cause the snow to fall from December 22 to December 31.  Adjust the dates to whatever you prefer.

$lis_date = date("md");
if ($lis_date >= "1222" && $lis_date <= "1231")

If you wanted it to snow into the first week of January too, you could do this.

if (($lis_date >= "1222" && $lis_date <= "1231") || ($lis_date >= "0101" && $lis_date <= "0107"))

The confetti mod requires some extra work.  There are several GIF and PNG files for different sizes of snowflake in the plugin’s /image/snow/ folder. I made a new folder, /image/confetti/ with copies of all those snowflake files and used GIMP to change them from white to multi-colored.  Any image editor that can handle transparencies would work.  Then I opened /script/snowstorm.js in a text editor and found this line.

var imagePath = sitePath + 'image/snow/';

And replaced it with this

var currentTime = new Date();
var month = currentTime.getMonth() + 1;
var day = currentTime.getDate();
var d = day.toString();
var m = month.toString();
var today = m+d;
if (today == "1231") {  // Use confetti on New Years Eve
  var imagePath = sitePath + 'image/confetti/';// relative path to confetti images (including trailing slash)
  } else {
  var imagePath = sitePath + 'image/snow/';// relative path to snow images (including trailing slash)
  }
:,


Tweet ThisFacebook ShareRight Click & Copy URL

3 Comments for this entry

  • Mick

    Oh, thats a nice touch, when the page is refreshed, the wind changes. Probably has a setting where you can make it show rates and wind changes right up to a blizzard

    • walter

      I can’t take credit for the changes in wind direction. That was in the original plugin code. But you’re right that there are settings for horizontal speed, vertical speed, and number of snowflakes.

  • Mick

    Not bad Walter. The effect is subtle enough that even an old codger like me can appreciate it without feeling like we have been caught in a cat-shot (a carrier launch) or car-jacked. That would make a nice Firefox add-in, to make all webpages restyled to white on a black background, and have the snow falling.

Leave a Reply

See Commenting Guidelines

Spam protection by WP Captcha-Free

Visit our friends!

A few highly recommended friends...