Scripts To Footer Plugin

stfI released my first official plugin about a year ago now: Scripts to Footer. It’s a very light-weight plugin (a single function, actually) that removes a few hooks controlling the script placement in WordPress. This results in those scripts being placed at the bottom of the page, instead of the top.

Why do that, you may wonder? Well, browsers load from the top of your page to the bottom, and sometimes those pesky scripts can take a little time to load. So, while you’re user is waiting for your page to load the browser is busy downloading jQuery. Instead, if you place your scripts at the bottom of the page (which should be standard practice!) it will load your page first and the scripts second. The difference in load times can be substantial.

There are a lot of plugins out there that take steps to improve page load times, but I couldn’t find one that was simple and straight-forward. This plugin takes a broad-stroke approach and forces all your scripts into footer – but only if they are enqueued properly! It has come in handy on quite a few sites I’ve created and I’ve seen significant decrease in page load times in a most cases.

Conflicts and Excluding Files (Keep Some Files in the Head)

I’ve also notice that is doesn’t always work with AJAX-enabled Gravity Forms or any scripted elements that require in-page scripting (some scripts need to be loaded in the header before the in-page script in order to work). There are a few workarounds in those cases – turn the plugin off and try something else, for example. Or, you can determine the name of the specific script and use the following code to exclude it – or, more correctly, to place it back into the head.

Disable Plugin on Specific Pages

Update from 2-17-14: Some users have requested that the plugin be disabled on specific pages where they were having conflicts. It seems the biggest area of concern is different slider plugins, which usually only appear on one or two pages.

Update from 2-23-14 I’ve added a checkbox option to disable the plugin on specific pages/posts as of version 0.2.

More Information

Check out the plugin page. Download it yourself and take it for a spin!

You can also view this plugin on GitHub here.