Add Christmas Snow Effect to your WordPress Site

You can add a Christmas snow effect to your WordPress web site by using a snowstorm javascript which has been around for more than ten years.

This used to be bundled with Jetpacks modules and I believe you can only access it now if your site is hosted on the main, but never fear you can add it to your site with a small snippet of code.

First download the latest version and move snowstorm.js in you js folder in your theme, there is also a minified version that you can use, but you may wish to change a few variables in the script.

Then in your functions.php add in the snippet below (minus the opening php block)

<?php // <~ dont add me in
// Enqueue snow script
add_action( 'wp_enqueue_scripts', 'wpb_snow_script' );
function wpb_snow_script() {
wp_enqueue_script( 'snowstorm', get_stylesheet_directory_uri() . '/js/snowstorm.js', array(), '1.4.4', false );
view raw xmassnow.php hosted with ❤ by GitHub

The author of the script has allowed some of the variables to be changed.

That’s it you now should have snow falling all around.


Leave a Comment