WordPress Plugin: the Conditional “Digg This” Badge

Please note: This mod is currently outdated. It has not been updated for use with WordPress 2.5 and several people have reported errors with it. I have not had the time to work on it lately, so it may be outdated for some time (or forever). If anyone would like to fix it and/or take over control of the project, let me know. It is open source, after all, you’re all free to edit and play around with it…

The Conditional Digg Badge WordPress Plugin automatically displays the “Digg This” badge on posts that already have a level of popularity with Digg.

Why, you ask? It’s been suggested by some that showing a Digg badge with a vote of “1″ may be discouraging to your users. It would probably be better not to show the Digg badge at all than to tell your users, “This article really isn’t popular.”

This plug-in makes use of the Digg API to solve that problem. When an article is loaded, the plug-in checks with the Digg API to see how many diggs your article has. If your article has a certain amount of diggs (10 by default), the Digg badge appears. Otherwise, the Digg badge does not.

Download the Source Code

You can download the source code for the Conditional Digg Badge here. When you unpack the .tar.gz file, you should have four files:

  • wp-digg-conditional.php – This is the base plug-in file. It hooks into WordPress, inserts the required .js files, and inserts some javascript to make the plug-in work.
  • check-digg-stats.php – This script processes the AJAX requests, sending information to the Digg API server and finding out how popular your article is.
  • wp-digg-conditional.js – This is the .js script that creates the AJAX requests, handles the responses, and edits the page as appropriate.
  • prototype.js – This is an AJAX framework. I didn’t make it, but the plug-in uses it.

Download the source code: WordPress Plugin: Conditional Digg This Badge, Version 1.0

Installing Conditional “Digg This” Badge

That’s pretty simple. Upload to your /wp-content/plugins directory. Unpack. Activate. Forget about it.

The tar.gz is organized into a directory already. Make sure the files are in the “wp-conditional-digg” directory – or else the path to the .js files and the .php script will be wrong. By default, the plug-in will display a “Digg This” badge for any article that already has 10 diggs.

How It Works… for the Curious

If you’ve read this far, you probably want to know how this plug-in works. Head over to the Documentation page for a thorough description of how the plug-in operates and what each file accomplishes.

Or, you can download the source code and jump right in. It’s not too long, and it’s fairly well commented – assuming you know a bit about php, js, and the WordPress API.

Please Leave Comments with Bugs!

This is a functioning plug-in, but I can’t guarantee it will work perfectly. If you encounter any problems, please leave a comment below so that I can look at it when I have time.

If you have any suggestions for improving the plug-in, leave that as well.

At the moment, I’m aware of one annoying problem. The Digg API server can take a while to respond – so it may take 10 seconds or so for your badge to appear. I’m looking into adding a cache’ing system that only checks the API server every 10 minutes or so.

Bookmark and Share:
  • Digg
  • Furl
  • del.icio.us
  • StumbleUpon
  • MisterWong
  • DZone
  • Technorati

29 Comments to “WordPress Plugin: the Conditional “Digg This” Badge”

  1. Takuya Misawa said this on

    My blog rarely get dugg, so there’s probably no use for my blog unfortunately. However, I love the concept and how it displays.

    Can the same thing done for StumbleUpon?

  2. Walkere said this on

    StumbleUpon doesn’t have a pre-built badge like that. What are you looking to display?

    If you just want a link to Stumble the page, there are plenty of plug-ins that do that. It looks like you already have a plug-in that posts a Stumbleupon link at the bottom.

    If you wanted to insert a big Stumbleupon link at the beginning of the article, that would be a piece of cake.

    Or, if you wanted to display the # of reviews your page has (and only show that if your page has X reviews), that would be possible. I worked out a script to check how many reviews a page has, so I would just need to build a badge like Digg has to display the # of reviews.

    Anyhow, let me know exactly what you’re looking for and I might be able to work it out this week.

  3. Chicago Plumber said this on

    Interesting. There are some good ideass presented here. I need to do spend some time reading more about these topics.

  4. Henry said this on

    Hi! You got a very nice site. I just bookmarked it.

  5. Max said this on

    Hi – just wanted to say good design and blog – cu!

  6. Dan (future gadgets blog) said this on

    I like your blog theme. I want to use it on my blog.
    Can you please tell me from where I can download these theme?

    Many thanks

    ——————————————————————————–
    Dan owner of the future gadgets blog future gadgets and inventions

  7. internullo said this on

    For me it’s very slow. From the moment i open a post and till the moment the badge shows up, it takes about 30s to 1 minute.

    Can i edit something to make it faster? Like a timer or something?

  8. Walkere said this on

    I’ve noticed that problem, too. There’s no timer built in to it, so there’s nothing in the plugin code that should be holding up the works.

    I have a feeling it has to do with the response time from Digg’s API server, and I’m not sure if there’s anything that can be done to optimize that.

    The best thing I can come up with is to put a kind of cacheing system into it, so that you don’t have to wait for the Digg API server every time a page loads. That should be done in the next week or so, hopefully.

  9. Aravind said this on

    Awesome idea. Cheers from India.
    As one above told, I started professional blogging for 2-3 weeks and i’m still in the beginning stages. So, to be realistic, i cant expect a Digg soon..
    But, this Plugin in awesome and nicely worked out.

    And i want to say you this (abt Stumbleupon)
    I too will be grateful to you for a plugin that shows the number of “Thumbs Up” for a site on stumbleupon.
    I will surely blog that in my blog too…

    Many Thanks from a 16-year young teenager.
    Take Care

  10. Lazy Man and Money said this on

    Excellent stuff, but as mentioned, it’s too slow to be practical. I’d like to see an Ajax/Javascript version. I found one for Delicious, but can’t seem to get it to work for Digg.

  11. Steve said this on

    Is it me, or does the plug-in not with wp-2.5? any thoughts/plans?

    /s

  12. Walkere said this on

    @Lazy Man. The current implementation does use Ajax. The problem isn’t necessarily the script, it’s the response time from Digg’s server. The plan was to build in a caching system with the WP database, but I haven’t got around to it yet.

    @Steve, I haven’t upgraded to WP 2.5, so I wasn’t aware that it was incompatible. I should be upgrading my sites soon, so I’ll probably work out an update. Not sure of an ETA… but soon.

  13. yosonic said this on

    phew I thought it was just me… I am setting up a few new blog sites… wish I hadn’t gone with 2.5 now!

    Ah well… waiting patiently

    Thanks for your effort though, anyone who offers up free stuff is a legend.

  14. tanicos said this on

    it doesn’t work on 2.5..it shows an error message and a help link which tells me to go to their site and check the latest format..

  15. Google Cash System said this on

    Hey, this was a great post. Really informative. I bookmarked it, and will definitely be coming back. :D

  16. Shara Radican said this on

    I couldn’t agree more…

  17. Darius Relles said this on

    do some ( search engine marketing) get the job done 1st then decide on some excellent ads pertinent , its not pretty effortless cash in days you’ve to complete a challenging get the job done 1st, you may get assist from this website. i’m positive is aware of and had of this to make some respectable adsense

  18. Backlinks said this on

    Dude i didnt find this blog my mom wouldve killed me. I owe you my life lol Awesome Blog Bro.

  19. Doktortitel said this on

    Hi! I’ve been following your blog for a long time now and finally got the courage to go ahead and give you a shout out from Kingwood Tx! Just wanted to mention keep up the excellent job!

  20. i-Goals said this on

    i-Goals is a 100% free website with sports, diet, and fitness calculators which include BMI, VO2 max, nutritional needs, running performance predictor, QB passer rating and many more. Also the site has a complete fitness and diet log. This includes sports such as running, bowling, cardio, weight training and many more.

  21. outdoor said this on

    [...] Web Cash » WordPress Plugin: the Conditional “Digg This” Badge [...]

  22. Gabriel Jefferson said this on

    Awfully helpful bless you, I believe your trusty visitors would probably want more writing along these lines keep up the excellent work.

  23. Andrew Smith said this on

    Highly illuminating bless you, It looks like your trusty audience may want more well written articles such as this continue the good hard work.

  24. Philomena Hildebrand said this on

    My brother suggested I might like this web site. He was entirely right. This post actually made my day. You can’t imagine just how much time I had spent for this info! Thanks!

  25. best ab workout how to get abs said this on

    Very interesting cheers, I do think your current readers would most likely want more items like this carry on the excellent work.

  26. legalne programy said this on

    I learned about this internet site via Google two days ago and that I am certainly enjoying all the statistics being shared appropriately! Many thanks again!

  27. black friday said this on

    It hooks into WordPress, inserts the required .js files, and inserts some javascript to make the plug-in work. If you encounter any problems, please leave a comment below so that I can look at it when I have time. I like your blog theme. .

  28. Robaire McCoy said this on

    Enormously entertaining many thanks, There’s no doubt that your followers may well want even more reviews along these lines continue the excellent content.

  29. tweet adder coupon code 2013 30%off said this on

    This specific tweet adder discount code may well be a great deal in order to tweets business owners because it can make their own operate simple and easy , powerful. Simply because the idea decreases the tariff of the program at the minimum regarding 30% off, many shoppers is bound to utilize this voucher due to the fact it will help to avoid wasting his or her. After the tweet adder promo code discount may be used, 35% is really a affordable amount of money you might count on you’ll conserve. A deduction tip of 20% might be perfect for substantial personal savings even so a new 25% discount is usually a much better conserve as part of your profits. These reductions rules can easily virtually help you in saving your small business income. It can be effective regarding tweets internet marketers to look at benefit from the tweet adder voucher due to the higher expense of this method specially for folks online marketers who will be just beginning out and about a company and even market in social networks as an example twitter. These discount rates make the perfect deal regarding twitting online business owners who’ve massive quantity of fans because the application may tremendously help save all of them operate and occasion. Over-all, the subsequent low cost can easily for reasons unknown preserve enough cash whilst supplying outstanding support regarding tweets internet marketers.

Leave a Reply