New Digg Buttons With WordPress (that don’t work?)

Digg has introduced some new buttons and here is how to use them with WordPress.

It’s smart enough to detect whether your link is a Digg permalink or a URL and whether or not the content exists on Digg already. If it exists, you’ll get the familiar yellow Digg box with a real-time Digg count to suggest visitors Digg your story. If the story doesn’t exist yet on Digg, the first person to click on the Digg It link will be walked through the submission process.

Before you ask, yes I do know that there are a multitude of plugins with the same or similar functionality, but they tend to use custom fields in WordPress which seem fairly bugged in WordPress 2.1 currently, and it is always better to use official solutions where possible.

Here is the most customized version of the new Digg code

Now we need to substitute some Wordpess finctions to automatically add data

WEBSITE_URL = the_permalink()
TITLE = the_title()
BODY = the_excerpt_rss(’40’ , ‘2’) (40 words and strip HTML)
TOPIC = choose your main theme – I will go for tech_news

So now we need to put that into code
Note:- It is WordPress messing up the quotes formatting in the post, not me in my code – easy to check by looking at the source which seems to be bug free and filling in the data correctly,

Then that code can be wrapped in a DIV, inserted after the_content() on various pages, and you have a Digg button that should work.

But the Digg Button Doesn’t Seem to Work

For some reason it isn’t picking up the data from any of the definitions, and it seems to be a problem at Diggs end.
I noticed the “digg” for the announcement any mention of bugs was just being buried.

I can’t use the Digg autodetection of URLs, because I need to be able to place Digg buttons on my front page where I have full post content rather than excerpts. Autodetect only picks up the root domain with the new code on the front page.

I don’t claim to be a code guru, I just plug bits of existing code together, so if I have made a mistake please don’t burn me at the stake.

Update: I have removed the broken Digg code from the site – it wasn’t picking up Diggs, and when clicked for an already Digged post, it was giving the submit form.
The new code can be buried until it works.

Liked this post? Follow this blog to get more. Follow


  1. says

    Hi Andy,

    I was trying to do just this with the Digg script to populate the Digg fields using the information from each post. If I understand your post right, you were unable to get this to work? I sure couldn’t…I hope there is a solution forthcoming somewhere out there.

    I’m using WP 2.0.5

  2. says

    I know a partially working solution

    Unfortunately sometimes it gets the auto-detection wrong

    Also I have seen it give a blank page in the iframe for a Digged page

    The seems no way to manually set the dig page if something is submitted, plus the partially working version is a bit of a hack, pulling in the actual digg widget code, and doesn’t have all the options.

  3. says

    I was having the same problem – The Digg badges worked fine if going to the direct URL, but when viewing the post on the front page, or by clicking the “more” button, the badge always showed 0-Diggs – even when using the specific URL option.

    I ended up using the trick to post badges on blogs, which uses an iframe to a small uploaded HTML file with the diggthis code in it.. works great :)

  4. says

    This worked great for me and on the domain not just the sub pages. I added a span tag to get the thing to dynamically align on every post headline.

    digg_url = ”;