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.

Creating And Writing Your Blog

Creating And Writing Your Blog

The success of a blog lies in the content. It is the content and the key words that consistently attract potential customers. Great blog content literally means something different on every blog. Great blog content is researched and not impulsive. You cannot treat the blog as an experimental playground and expect it to work for you. It is designed to mean business and make you presence felt online and you have to ensure it performs the way you want it to.

Get My Free Ebook

Post a comment