How to Only Show the Digg Badge for Popular Posts
Digg can be a great source of traffic and recognition for tech related blogs. Some people take it to the extreme though, and show the “Digg This” badge on every article they write.
As others have pointed out, this can be counter-productive. People don’t like to read articles that have just one Digg - they seem unpopular.
So here’s a solution: use the Conditional “Digg This” Wordpress Plugin to only show the Digg Badge for articles that have a certain number of Diggs.
Why Shouldn’t You Show the Digg Badge on Every Article?
It’s easy enough to plaster the Digg Badge in your template or use a plug-in to add it to every post. Most of your posts aren’t going to be popular though. You’ll get at most one or two Diggs… nothing to write home about.
When a user opens your article, he or she might be impressed by “100 Diggs.” He or she definitely won’t be impressed by “1 Digg.” That’s a hint that your article wasn’t anything special - so why should the reader keep going?
Using the Plugin to Only Show the Badge on Popular Articles
The Conditional Digg This plug-in was designed to address this issue.
All you need to do is download the source code, upload it to your plugins directory, unpack the tar.gz, and click “Activate.” You don’t need to modify any settings or insert anything into your template. It’s all automated.
How Does It Work?
The basic concept behind the plugin is this:
- Load a story in your Wordpress Blog
- Check the Digg API to see how many diggs the article has
- If the article has 10 or more diggs, show the badge…
- Otherwise, leave it alone.
Originally, I coded the plug-in to use a php function to access the API and check the number of Diggs each article had as it loaded. This worked perfectly - but it took a while. Sometimes, the API is slow to respond. If the API took 8 seconds to spit back a response, that meant your page would take 8 extra seconds to load up.
Even if the API was responding quickly, this was a problem for the front page and category pages. At best, the API takes about .25 to .5 seconds to respond - and with 10-15 checks on a page… you’re still waiting a good long time for the page to load.
Load First, Check the API Later
The solution I came up with was to use some nifty AJAX to perform the API checking behind the scenes.
The plug-in creates an AJAX request for each article. It sends information to a php script which accesses the Digg API behind the scenes. The page loads up instantly and AJAX will quietly do its thing. When the response is ready, it’ll change the page to include the Digg This badge if necessary.
So, the next time you want to display a “Digg This” badge on your article, think about how many diggs your article has already. Or, use the Conditional “Digg This” Wordpress Plugin to automatically add a badge to your popular articles.







Great Resources: Learning JS, AJAX, and DOM | Web Cash said this on February 19th, 2008 at 6:01 pm
[…] in the weekend, I set about creating my first real AJAX application. My Digg Wordpress Plugin uses AJAX to check the Digg API for info on an article after the page has […]
Steve said this on April 12th, 2008 at 6:32 pm
The badge does not seem to work with wp 2.5. Any plans to update it?
rgs
/s