WordPress Bloggers: Have You Fixed Your Digg Button?

There’s an annoying bug (or feature, depending on how you look at it) in site-integrated Digg buttons that can be a particular pain for WordPress users. If you’ve added a Digg button to your post pages, you’re likely affected.

Here’s the problem: the Digg button treats URLs with named anchors differently than those without. So it considers the URLs below to be different, even though they show the same content (albeit one would be at a different page position):

http://wordpress.jdwebdev.com/

http://wordpress.jdwebdev.com/#test

Sure, the Digg button’s behavior could be useful in some situations (like when anchor-based permalinks are used). But what happens when you click the “Read more” link on a WordPress post? Yep, it takes you to a URL with an anchor. Although this seems trivial, it could nevertheless result in:

  • Your readers’ Diggs being split across two submissions for the same thing.
  • Your Digg button showing a “Submit” option instead of its true Digg count.

Here’s how to fix it:

It’s pretty simple. This is assuming you added the Digg button to single post pages yourself as opposed to using a plugin. (If you use a plugin, check and see if the author took the anchor factor into account. If not, contact the author and send him or her a link to this post.)

  1. Login to WordPress administration, then go to Appearance > Editor > Single Post.

  2. Find the code for the Digg button. Here’s the typical JavaScript:

    <script src="http://digg.com/tools/diggthis.js" type="text/javascript"></script>

  3. Insert this line of code right before that one:

    <script type="text/javascript">digg_url = "<?php the_permalink(); ?>"</script>

  4. Click Save, and you’re done!

You shouldn’t have to worry about other buttons like those for BloggingZoom, Sphinn, and Scoop, since they don’t seem to have this anchor issue.

Social this post and share this tip with other Digg-using bloggers!

Did you enjoy this post? to get even more WordPress tips, news, and resources!

StumbleUpon

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*