Add a digg count to your WordPress posts

One of the things that originally attracted me to WordPress was the extensibility of plugins. But I have more recently come “full-circle” in my thinking seeking to do more without the use of plugins. Not that I don’t like plugins, but there are some simple tasks that are more efficient to do directly. Too many plugins unnecessarily slow down your blog, in my opinion.

So here is a way to directly place a Digg counter/link neatly aligned in your blog posts using CSS.

For this, I chose the “Digg This” button that you can see at the upper left of this post. This is called via Digg’s own javascript using this:

<script src=”” type=”text/javascript”></script>

I wanted to have this neatly wrapped in the upper left corner of the content. This is easily accomplished via CSS in a div tag:

<div style=”padding-right: 8px; padding-bottom: 4px; float: left;>
<script src=”” type=”text/javascript”></script>

Where you place this is up to you depending on your theme. For me, this went in the single.php file just before WordPress outputs the post content with <?php the_content(); ?>.

You can easily add this to your theme using the WordPress theme editor. Go to the WP admin panel and select Presentation > Theme Editor. Using the Theme Editor, you can select the necessary theme file(s) from the right hand side. The single.php template is indicated by “Single Post.”


  1. says

    Thanks for the comment. However, the point was to NOT use a plugin for a simple task that doesn’t really need one. “Over-plugging” WordPress leads to, IMHO, a less efficient blog.

    That being said, you certainly could just as easily add title and description (and a few other fields) automatically without a plugin. The fields you can pass can be reviewed here: Those could be easily populated with some simple php or js. (Maybe a topic for a followup post?)


Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>