robinadr

Posted in January, 2011

Egypt protests

Click the image for the large version.

Credit: latenightcabdriving on reddit.

You should use the Use Google Libraries plugin instead.

Update: I’ve modified the plugin to use a generic URL (.../1/jquery...) which loads the latest 1.x version. That way I don’t have to change the plugin everytime jQuery is updated.

The ZIP file has been updated, just overwrite your old googlejs.php file and everything will be gravy.

In an effort to save bandwidth, I made a quick plugin to modify WordPress to use Google’s Libraries API, which offers a Google-hosted jQuery. Here’s the code in question:

function radr_google_js( &$scripts ) {
    $scripts->remove( 'jquery' );

    $scripts->add(
        'jquery', // shortname
        'https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js', // url
        false // dependancies (none)
    );
}

add_action( 'wp_default_scripts', 'radr_google_js' );

If you’re interested in using this on your own site, you’re welcome to download this quick plugin. Just follow standard procedure — unzip, copy to wp-content/plugins, and activate.

Wikipedia had it right…

…is a hero.

And, for good measure: