Defend Net Neutrality Plugin

I saw Jeff having to step away from the computer after being subject to some Comcast propaganda. The combination got me to loop around and make a little WordPress plugin for those who might be intimidated by editing their actual theme code.1

The plugin is here if you want it.

This is also a nice little (very tiny) intro plugin for someone who just wants to see how to add javascript to WordPress via the wp_enqueue_script() function. I’ll leave the basics plugin basics to this WordPress plugins introduction.

function net_neutral_enqueue_scripts() {
    wp_enqueue_script( 'net_neutral', '//widget.battleforthenet.com/widget.js', '1.0',true );
}
add_action( 'wp_enqueue_scripts', 'net_neutral_enqueue_scripts' );

You can name functions whatever you want but make sure the name is unique. Underscores are the norm. There’s more about WordPress naming conventions here if you’re interested. For now, just name things in ways that mean something both to you and others. If you are like me, it may be tempting to make your function names into inside jokes. I usually find them far less funny when I come back later and can’t recall the joke.

Other than that, the wp_enqueue_scripts pattern breaks down to a unique name, script location, script version, and whether to put the script in the footer or header (default is header). If you had other javascript files as dependencies you can do that here as well but that’s not in this example.


1 So maybe this is could be seen as a bad thing but I’m going to look at it as different options for different comfort levels.

Comments on this post

No comments.

Leave a Reply

Trackbacks and Pingbacks on this post

No trackbacks.

TrackBack URL