Integrating digg in your Wordpress weblog. 2 easy steps.

Posted on 25 October, 2007 by Peterandrej

Digg.com is one of the most popular websites in the world today. Getting on the front page of digg is every bloggers big wet dream. Getting there would mean a huge amount of traffic, and possibly fame and fortune (who knows).

And digg.com has made it extremely easy to integrate their services into weblogs. Want a digg-button on your blog displaying the number of diggs a post has? No problem. Want that ultra-cool “digg-style” rating-system in your comments? No problem either.

peterandrejcom-20071026.jpg

Ok, I’ve integrated digg all over my blog (maybe to much??). It even LOOKS exactly like digg.com. What can I say? I got inspired.. But, you don’t have to go that far. Integrating a digg-button may be enough. And that comment-rating of course..

Here is how you add a digg-button:
Copy this code and paste it into your template somewhere:

<script type=”text/javascript”>
digg_url = ‘<?php the_permalink() ?>’;
digg_window = ‘new’;
</script>
<script src=”http://digg.com/tools/diggthis.js” type=”text/javascript”></script>

This will return a button just as the one I have on my “digg-inspired” weblog today. The button will let your users digg your stories, and it will also show how many diggs your stories got. You could add the button to your posts (paste it into single.php) or to your front page (paste into index.php). I’ve done both, just to get that “digg-look”. Cool, right?

Ok, thats the button.

Here is how you add a comment-rating just like digg.com:
To get this cool feature (you can see it on my blog if you wonder what I’m talking about) you have to use a plug-in for Wordpress. The cool plug-in is called “comment-carma” and could be downloaded here.

The installation process was somewhat confusing on the download-page of the plug-in, so I’ll explain it better here:

1. Download the plug-in, unzip it and upload the entire unzipped folder to your plug-ins directory (/wp-content/plug-ins/) - just as any other plug-in.

2. Activate it in your wp-admin area.

3. Add the following code to your header.php template file. Paste it somewhere between </head> and <body>.

<script type=”text/javascript” src=”http://domain/wp-content/plugins/ck-karma/ck-karma.js”>
</script>

Important! See the highlighted “domain”? Well, put your domain here. My domain is http://www.peterandrej.com, so my code look like this:

<script type=”text/javascript” src=”http://www.peterandrej.com/wp-content/plugins/ck-karma/ck-karma.js”>
</script>

4. Ok, now paste this code into your comments.php template file:

<?php ck_display_karma(); ?>

You can not paste this anywhere you want, you must keep it inside the comment-loop. Don’t know what the comment-loop is? Well, its the code-snippet that display your comments. It would make most sense to paste the code somewhere near the name of each commentator, so just find this code:

<?php comment_author_link() ?>

Found it? Well, paste the code above right after this one, like this:

<?php comment_author_link() ?> <?php ck_display_karma(); ?>

Easy. Now save it all, and head over to your site to test it all out. It should work. It DOES work on my blog, and I’m not even a php-expert. You’ll surely manage this installation process.

Got problems installing?

Well, post a comment and I’ll try to help you.. Then you could even try the rating-system! Digg is just so digg..

Share this entry:

del.icio.us:Integrating digg in your Wordpress weblog. 2 easy steps. digg:Integrating digg in your Wordpress weblog. 2 easy steps. spurl:Integrating digg in your Wordpress weblog. 2 easy steps. newsvine:Integrating digg in your Wordpress weblog. 2 easy steps. blinklist:Integrating digg in your Wordpress weblog. 2 easy steps. furl:Integrating digg in your Wordpress weblog. 2 easy steps. reddit:Integrating digg in your Wordpress weblog. 2 easy steps. fark:Integrating digg in your Wordpress weblog. 2 easy steps. blogmarks:Integrating digg in your Wordpress weblog. 2 easy steps. Y!:Integrating digg in your Wordpress weblog. 2 easy steps.
digg-theme for wordpress