I know there’s several Wordpress Plugins available to add a “Digg It” button to your Wordpress blog, but I still prefer to add hacks in my Wordpress theme to accomplish the functionality without having to bother searching for, downloading and installing a Wordpress Plugin. As a webmaster with several Wordpress blogs and several different versions, I find it easier just to pop open my Zend Enviornment and edit the PHP code by hand. Here’s a quick and dirty way to add a “Digg It” button into your blog posts. It takes all of 5 minutes to complete. This example will add a Digg button like the one’s on this blog, in the upper left hand corner of every post. This will make it easier for your readers to Digg articles they like. It is advisable to place the “Digg It” button someplace easy for your readers to see so that they don’t have to do much searching to digg or review your articles.
Step 1: Open the file /wp-content/themes/*your-theme-name*/index.php and look for the following code:
Please note: the code may also look like this…
Either way you’re looking for the beginning of the post content output loop if you want your Digg It widget as it appears on this site in the upper left hand corner of every blog post.
Step 2: Add the following code directly before the code listed above.
****Please note (added 8/10/2007): If you’re having a problem copying and pasting this code from the blog, please go to this page to copy and paste the code…
http://www.affiliatebestprograms.com/Wordpress_digg_code.htm
Note: you can add it anywhere you want in your post loop. For example, if you want it on the right of every post all you have to do is change “float:left” to “float:right”. If you want the widget at he bottom of your posts, allyou have to do is add it after the code from step 1. Experiment with it and have fun.
About Digg
Digg is a Social Networking and bookmarking website that allows members to submit stories and have other people vote on them to increase you article’s popularity. If you can get an article dugg a lot of times, you will certainly be getting a lot of hits from Digg users. Digg is primarily technology oriented, however they have been expanding the service to include other types of articles. I would also advise against trying to cheat the Digg system by registering multiple accounts and digging your own stories because you will find yourself banned and all your stories removed.
There are additional ways to customize the look and feel of the Digg widget that are not covered in this article and if you’re interested in extending the functionality, visit the Digg Tools Page
If anybody has any questions about how to implement this code, feel free to post a comment here. If you are using this code in your blog, please post a comment with a link to your site so we can see it. We are a “dofollow” blog and we reward our commentors with backlinks for posting well written, intelligent comments.
Happy Publishing !!





















Great article, thanks, in the next article please elaborate on adding a reddit button.
Thank you for creating and sharing this code. I discovered it through a Google search.
I placed the code right before the and it does not show up. Are you able to see what I’m doing wrong?
Thank you for any help you can provide.
I know im gonna dig this… lol Im digin it man. Nice hack!
Deborah,
You need to replace the question marks with either single or double quotes. I’d suggest copy the code from the blog post into notepad or any text editor first and then copy and paste it into your blog.
That will make it work. Wordpress is a pain in the butt to post code in a blog post, especially if people are copy and pasting it.
This is exactly what I expected to find out after reading the title ress Hack : Add a Digg Button to Your Posts. Thanks for informative article
[…] have a wordpress blog you can get a Digg it wordpress plugin. You can also get the Digg hack code here which is code to put the digg it button on any site. These Digg buttons will give a visual reminder […]
I guess I’m not understanding how this works. Or maybe the Freshy theme is just incompatible with digg. :)
I’ve tried putting this into the index several times–I must be doing something wrong but this is a bit beyond my coding capabilities! The question marks you refer to in the previous post, does that mean the code would be
or then? Does the_permalink need to be changed to something else?
Just make sure when you copy and paste all the quotation marks come out as regular quotes. Wordpress has a way of switching the quotes to begin quote and end quotes. I’m, trying to figure out how to work around it, but it seems to be a problem with the TinyMCE editor in wordpress.
also, the
tag at the end of the code needs to be removed. For some reason Wordpress is adding it to my post…
I put the code in a regular html file in case anybody is having a problem…
http://www.affiliatebestprograms.com/Wordpress_digg_code.html
I REALLY want to thank you guy, you really came through on this one, it’s so crazy because digg.com etc and those other big sites don’t even include this kind of information, it worked perfectly for me at TerranceCharles.com …
[…] the full story here No Comments so far Leave a comment RSS feed for comments on this post. TrackBack URI […]
Hi…Man i love reading your blog, interesting posts ! it was a great Wednesday
Hi,
I added the hack, but I noticed it’s not digging the individual story, but my whole blog? how do I set it up so it diggs the story and not the complete blog?
hi Lindsey,
It seems to be working when I check the blog. One thing, you should enable permlinks on your blog. Enabling permalinks is simple, just go into your Dashboard > Options > Permalinks
You have a few options but I’d recommend selecting “Date and name based” and click “Update Permalink Structure” to enable them.
What permalinks do is it re-writes your blog post URL’s to more search engine friendly urls. For example, your most recent post’s url
http://lindseyharper.net/?p=34
Would be rewritten to
http://lindseyharper.net/2007/11/17/Seattle-Mariners-Ball-Girl-Behind-the-Back-Catch-Picture-of-the-Week-Dateline/
You’ll notice the majority of blogs that get indexed heavily by Google use a permalink structure as opposed to the ?p=xxx structure
This is a useful hack. I will keep this in mind and probably will try it out on our blog.
Great tips that is useful for all bloggers. Thank you
hi thanks for making it easier to do than most posts out there.
I got it working but one question.
is there a way to make the badge/button just a little bit smaller?
because of the size of the header image I have always used, it just is not fitting perfectly with all of the older posts.
if not I will just have to make the image a little smaller from now on.
thank you again.