Add Digg This! Button to Wordpress Posts and Float Right

A few people have asked how I get my Digg This! button to float to the right in every wordpress post.

Here is the code I use:

<div style=”float: right; margin-left: 15px; margin-bottom: 2px;”>
<script type=”text/javascript”>
digg_url = ‘<?php the_permalink() ?>’;
</script>
<script src=”http://digg.com/tools/diggthis.js” type=”text/javascript”>
</script></div>

For my current theme (Not So) Fresh I had to add it into two places, the main index and the single post pages. Here is what it looks like in each of those places:

Screenshot of index.php:

Index Page with Digg This Button

Screenshot of single.php:

Single.php wordpress digg button

Hopefully that helps, if you have any questions, email me or post them in the comments section.

    

5 comments so far »

  1. Matt said

    March 22 2007 @ 3:27 am

    Fantastic! I tried out Digg this, but found it too obtrusive on my posts - this’ll rectify that problem!

  2. Chilly said

    March 26 2007 @ 10:20 am

    Am I missing something? I pasted that text just like you had it in the screenshots, and nothing shows up on my posts. I tried it on two different blogs. Made sure I was looking at posts that had been submitted to Digg.

    Is there another step?

  3. How I got that pretty Digg It Button | ChillyCool Web Digger said

    March 26 2007 @ 10:46 am

    [...] I tried the script from Brandon Hopkins, and that just didn’t do anything.  Not sure if it’s a WP version issue, or what, but [...]

  4. Fred said

    May 26 2007 @ 8:52 am

    Brandon,

    I still cannot get the button to show up on my site, fredsdigitallife.com. Can you help me?

  5. Nia said

    July 11 2007 @ 12:12 pm

    The above is what I’m using…just on ONE post. I’m isng it IN the post not in the post template

    post’s url:
    http://getguardit.com/guards-you-against-out-of-sightout-of-mind/

    site’s url
    http://getguardit.com/

    I submitted this to Digg a few hours ago. I submitted using the post’s URL. However I notice that the Digg button associated with the post’s URL has “1″ (that’s me and my submission) and the Digg button in the post when the post is on the front page (as it is today, the post was published today) has “0″

    How can I make sure that the digg button that appears in the post is tallying. If I click it, it takes me to digg and show the site url, not the post url…

    Yeah this situation may be too particular to me…I mean the answer might not have any value to anyone but me…but anyway I have to ask. I’m stuck.

    Thanks for any light you can shed

Comment RSS · TrackBack URI

Leave a comment

Name: (required)

eMail: (required)

Website:

Comment: