Extra credit Adding your new jQuery plugin to your Word Press plugin

Now you're free to go and install your WordPress plugin and include jQuery plugin on as many sites as needed! However, in case you're wondering, yes, we can refine the installation process a bit more and just incorporate this jQuery plugin inside our WordPress plugin.

The first step is to simply drop our jquery.authover.js script inside our plugin directory and then use the wp_enqueue_script to evoke it. You'll want to pay particular attention to this use of the wp_enqueue_script function, as it will also include jQuery 1.4.2 IF its NOT already registered in the theme or plugin! This means that client's sites, which don't already have jQuery included, don't need to worry! Just installing this plugin will automatically include it!

function addjQuery() {

wp_enqueue_script('authover', WP_PLUGIN_URL . '/add_author_bio-tbs/jquery.authover.js', array('jquery'), '1.4.2' );

We'll then add a function to our WordPress plugin which writes in the jQuery script that uses the authorHover function of the plugin. Normally, it would be better, and it is recommended to load up all scripts through the wp_enque_script function, but for very small scripts that are so customized, you're sure will not ever conflict, and you know jQuery is already loading in properly (as we are with the plugin), if you want, you can just hardcode script tags like so:

function addAuthorHover(){

echo '<script type="text/javascript"> jQuery(function(){

jQuery(".authorName").authorHover(); });

Lastly, we add the action filters which will evoke those functions:

Now, if you remove your jQuery plugin from your theme and make sure that your plugin is activated, you should see the exact same results as before! In the next screenshot, you'll notice that I've added a URL to my profile, and now the Find Out More feature set to degrade nicely if no URL was present, just automatically works. Wonderful.

G3 public domain coastal image

Lorer incidi exerci dolor Excef

Tocc-l CilvftH

Tessa designs and programs dean, user friendly, accessible 1rWcb 2.0" sites and applications driven by Databases, XML and JSON. Iier designs are pure CSS and CXJIITML5 based. She specializes in mobile web development for Android and iPhone and she's also a

PHP, JavaScript and ActionScript expert. Find Out More

usmod tempor tiiam, quis nostrud uat. Duis aute irure it nulla pariatur. . officia deserunt mollit an im id est iaborum.

Blogging From The Beginning

Blogging From The Beginning

The Blogging From The Beginning course was specifically designed with these people in mind. It starts at the very beginning, by helping them choose the right platform and takes them all the way though creating content, getting traffic and making money from their blog. It is simple, straight forward information that will help them even if they've never heard of blogging before. It will teach them how to get started and quickly harness the power of blogging for themselves.

Get My Free Ebook


Post a comment