add digg and delicious links to your blog

Posted September 27th, 2008 at 19:49 by Kaweh

Filed under: kawehdashti.com

Join the forum discussion on this post - (1) Posts

Hello humans.

A couple of weeks ago I added simple delicious.com and digg com text links to my wordpress template. Now, every time I write a post, wordpress automatically adds a post-specific digg.com “digg this” and a delicious.com “bookmark this” link to the bottom of the post.

I did this because the links, widgets, buttons etc that delicious.com and digg.com provide for their users are too big, do not fit into my template and/or are not customisable enough. Having unsuccessfully searched far and wide for a how-to for simple customised text links, I decided to write a how-to of my own.

Before you start, it is important that you place the links between the code-snippets you can see below. If you don’t, the links will not be post-specific. They will instead just add your blog address, rather than the post’s permalink.

The following code should be applied to your index.php and the files that create your single posts and archives, normally single.php and archive.php

Adding a digg.com link:

<a href=”http://digg.com/submit?phase=2&url=<?php the_permalink() ?>&title=<?php the_title(); ?>”>Digg This</a>

This link can be styled using CSS just like any other html link.

In your index.php add the above code for the link somewhere between

<?php while (have_posts()) : the_post(); ?>

and

<?php endwhile; ?>

Adding a delicious.com link:

<a href=”http://del.icio.us/post?url=<?php the_permalink() ?>&title=<?php the_title(); ?>” target=”_blank”>Bookmark This</a>

Again, this link can be styled using CSS and should be added in your index.php somewhere between

<?php while (have_posts()) : the_post(); ?>

and

<?php endwhile; ?>

Del.icio.us has been relaunched as delicious.com, but the old domain still works in the link. I don’t know if this will work forever, and as soon as I know how to add the link with the new domain I will update this post.

Disclaimer: I am not a PHP guru. The stuff you see here worked for me, if it messes up your website, tough. Rant off in the forum if you like.

graphic derived from the photo “Lego DNA” by mknowles

Technorati Tags: , , , , , , , , , , , , , ,

1 Comment » Bookmark This     Digg This

1 Response to add digg and delicious links to your blog

  1. Hugh

    It’s considered bad form to submit something from your own blog to Digg! ;-)

end of line...