WordPress

Using the WordPress ‘Digg This’ Plugin in Individual Posts

Aviran’s ‘Digg This‘ Plugin for WordPress is a masterful piece of code in use by thousands of bloggers. The plugin requires that you put a line of code in your template. [Not always an easy process to find the right spot.] In theory, this is a great idea as the ‘[tag]Digg[/tag] It’ button doesn’t show up until your post gets Dugg. The plugin even sends you an email when the button first shows up in your post. Cool!

However, as John Chow pointed out recently, you get an ugly red error splotch if your post is Dugg from upcoming stories instead of the story post itself. What can be done? It would be nice to control which posts get the button. However, the ‘Digg This’ plugin does not give you that choice. Normally, you cannot run PHP code from a post. Or, can you? Thanks to another superb plugin by BlueSome named Exec-PHP, you can do just that.

Here is how to do it:

If you don’t have the ‘Digg This’ plugin installed then download, install, and activate it.

Next, download the Exec-PHP plugin, install and activate it from your plugin panel in [tag]WordPress[/tag]. Then, take the code from Aviran’s instructions and put it in your post(s) instead of your template.

Put it in the top, bottom, or both places. I have found that wrapping it in paragraph tags works best here at RL Digital. I put this code right at the end of the post.

Be aware, to use the Exec-PHP plugin – you need to be running WordPress 2.x.

In summary, this technique allow you to control in what posts and where in the post to put the ‘Digg This’ button.

Be Sociable, Share!

2 comments

  1. Ankur

    Recently there is a new plugin that integrates Digg with more features and an admin interface. It requires zero lines of code and is available at http://dev.lipidity.com/dev/digg-this-wordpress-plugin-reloaded

    It also includes options for the wrapping of the Digg Button for styling so this hack isn’t necessary, and has a plethora of useful features.

  2. Corbin

    What I want to do on my blog, is every few hours take the oldest post and move it to the
    front of the queue, all automatically. Anyone know if there is a plugin that can do this or
    a simple way to set up another plugin to do this (use my own feed perhaps)?
    Thanks.

Comments are closed.