#5 W3 Total Cache for WordPress Users
Finding the Build Script Hard Work?
The scope of the HTML5 Boilerplate by Paul Irish and the team is pretty big. In fact, they seem self-aware of this, sending a questionnaire to their users, trying to figure out which parts of the project people use or don’t use. Here are the results.
Part of the Boilerplate is a tool called the Build Script; a script that runs in Terminal that essentially speeds up your website through compressing your code and images, forcing visitor’s browsers to cache everything, and probably some other wizardry that I can’t fathom.
Eh?
Unsurprisingly over 70% of users don’t use the Build Script. Whilst the BS seems great, it’s one weakness is that it requires a bit of time-investment to download Terminal stuff and figure out what’s going on. Sure, the HTML5 team have videos, but as soon as you start watching them it’s immediately clear that Paul and the team are already perfectly comfortable with Terminal and assume we are too. When Paul started typing gibberish like ‘Ant Build’ into the Terminal I imagined many of the designers out there simply switching off. From the outsider point of view it’s more developer territory. Don’t get me wrong, I think the Build Script is great, but there’s an easier way…
The Good News
If you’re in the habit of building websites on WordPress, there is an amazing tool that will pretty much do the same thing as the Build Script, but with a nice user interface and no Terminal work :-). I’m talking about a free plugin called W3 Total Cache, which I’ve seen recommended in many places but not bothered to check out until now. I’m so pleased with it that I’m going to side-park the Build Script from now on (unless I’m working on a non-WordPress website of course).
Video Notes
Don’t forget to empty your cache in the ‘performance’ tab of W3 Total Cache every time you upload a piece of code that W3 Total Cache will compress e.g. if you have CSS compression enabled and you upload a new version of your stylesheet you’ll need to empty the cache before you see the changes to your website.
Here is the link about why you should use the enqueue method to load jQuery and not hardcoding.
Please use the below code for running jQuery from the functions file. Ignore my suggestion in the video, it actually broke the jQuery in my Dashboard afterwards:
function my_init_method() {
if(!is_admin()) {
wp_deregister_script('jquery');
/* =Jay. This code taken from Digging Into WordPress by Chris Coyier + modified so that jQuery is in the footer, with reference to: http://codex.wordpress.org/Function_Reference/wp_enqueue_script */
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/ jquery/1.6.1/jquery.min.js"), false, '1.6.1', true);
wp_enqueue_script('jquery');
}
}
add_action('init', 'my_init_method');