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.