Share This (jQuery): a WordPress plugin

Monday, 30 July 2007

I have made a useful modification to Alex King’s excellent Share This WordPress plugin. Share This adds a nice popup to your posts allowing readers to easily submit the post to any number of social networking and news sites. The original version relies on the large Prototype JavaScript library, which adds to the download size for the page. Share This only uses a sprinkling of its features, so I wanted to replace it with something smaller.

I have recently redesigned this website; it now uses the marvellous jQuery library for some of the effects. So to avoid having to include Prototype, I modified Share This to use jQuery instead of Prototype. If you want to reduce the time taken for your pages to load, you could replace the original Share This with my version; this is is especially good if you are already using jQuery.

To use this version of Share This, first install the original Share This (version 1.4), and then download Share This (jQuery) and replace the original share-this.php file with the new one. Read on for more details.

Here are the changes I made, compared to version 1.4 of Share This.

Use jQuery instead of Prototype.
jQuery is included in WordPress 2.2 and later versions. For earlier versions, you should download jQuery and copy it into the wp-includes/js/ directory in your WordPress installation. Make sure the file name is jquery.js.

Behave nicely if somebody tries to load the plugin file directly.
If someone tries to load the share-this.php file directly, just show a blank screen. The original version shows an error message.

Use a sliding “roller blind” effect when showing the Share This popup window.
Just because it looks nice.

Remove some unused code.
Because it was unused.

My modifications are in the public domain.

Now, there is one other change. The position of the popup window is not the same in all browsers; in some browsers (such as Firefox) the popup appears below the “Share This” link; in others (such as Internet Explorer) the popup appears just to the right of the link. I don’t mind the inconsistency: both variations look nice in themselves.

I thought about using the Dimensions plugin to emulate the original Share This more exactly. But in the end I decided to keep things simple and avoid introducing yet another file.

Tags: , , ,


You can leave a comment, or trackback from your own site.

  1. Wow! these all are good add-on I have tried on on this…Thank you very much for sharing. But, you have to update this post now, many cool and new ads-on are available.

  2. I blog often and I seriously thank you for your information. The artjcle has
    really peaked myy interest. I will bookmark your blog and keep checking for first time
    details about onde per week. I opted in for your RSS feed as well.

  3. fantastic issues altogether, you just received a logo new reader. What would you suggest in regards to your publish that you just made a few days ago? Any positive?

  4. There also exists a smaller garden that houses baby turtles rolling around in its small lake.
    You can see the beautiful sights here, sip excellent Spanish wine,
    and hear the Spanish guitar while you taste some delicious Spanish food.

    Since alluvium is quite soft, it erodes in an incredibly limited time or may be quickly covered
    over by new deposits, thereby quickly hiding proof earthquake fault lines.

  5. knowledgeable content

  6. knowledgeable content

Leave a comment