Wordpress: Add a ‘Digg it’ button to your posts
There are several Wordpress Plugins available to add a “Digg It” button to your Wordpress blog, but I still prefer to add code in my Wordpress theme to accomplish the functionality without having to bother searching for, downloading and installing a Wordpress Plugin. So this is for people who are not afraid to play with the php code. Here’s a quick way to add a “Digg It” button into your blog posts. It takes 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/*theme-name*/index.php and look for the following code:
Sometimes it looks like this:
Both code is the same and you are looking at the beginning of the post content. If you want the Digg button appear in the top left corner of you post include this piece of code right above the above mentioned code:
note: If you want the button to appear on the right of your post simply replace ‘float:left;’ to ‘float:right;’. It’s that easy.
I’m using a template (Hemmingway)that has only a few lines of a post on the homepage. The complete post can be read when clicking on the ‘read on’ button. I choose not to clutter up my homepage with buttons but I do want a ‘Digg It’ button to my posts. In my case I opened up /wp-content/themes/*theme-name*/single.php
This file is designed for a single post. Just follow the above instructions and you’re all set! Happy digging!