
With the new release of Digg.com v1, there’s also a new way to add the Digg share button. You share a link on either Facebook or Twitter, and if it’s a good story, it’ll end up on Digg.com. I’ll show you how to add a Button/Image to your website, that will copy the existing url and bring it with the clicker to digg.com/submit.
How to Add The Digg Share Button
I’m not sure if this technique was used before, I just recently started using Digg.com more than usual and figured I’d implement this feature to my site. Anyway, find a Digg icon you can use, I’ve posted a few free social media icons that you can use.
WordPress
<a href="http://digg.com/submit?&url=<?php the_permalink(); ?>" target="_blank"><img src="/images/social-media-image.png" alt="Digg Share"></a>
Joomla
You want to get the alias from your database, the alias is the SEF words after your domain.com/search-engine-friendly-url. To do that you want to add this code to a PHP enabled module – this can be done with an extension.
<?php $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); if ($option=="com_content" && $view=="article") { $ids = explode(':',JRequest::getString('id')); $article_id = $ids[0]; $article =& JTable::getInstance("content"); $article->load($article_id); echo $article->get("alias"); } ?>
If this code doesn’t work for your CMS/website, just google “how to get title with php +yourCMSname” and change the code, from title to alias.
You want to add that code like this. And change domain.com to your domain.
<a href="http://digg.com/submit?&url=http://domain.com/<?php $option = JRequest::getCmd('option'); $view = JRequest::getCmd('view'); if ($option=="com_content" && $view=="article") { $ids = explode(':',JRequest::getString('id')); $article_id = $ids[0]; $article =& JTable::getInstance("content"); $article->load($article_id); echo $article->get("alias"); } ?>" target="_blank"><img src="http://rushtips.com/wp-content/uploads/2012/08/Digg.gif" alt="Digg Share Button"><?php ?></a>
I had to add that last “<?php ?>” before the closing </a> tag, not sure why, but that made it work. Try without first!
When it works, it should look like this:
Let me know if you have any questions, and if it worked or not.