How to put digg button in wordpress without plugin

How to put digg button in wordpress without plugin

Recently digg launched the version 4 and many people want to put digg button on there wordpress sites and blogs. There are many wordpress plugins available for putting digg button on wordpress.

How to put digg button in wordpress without plugin

But I cannot recommend to use the wordpress plugin for putting the digg button.

How to put digg button in wordpress without plugin
How to put digg button in wordpress without plugin

You can use the following code in your wordpress theme for putting the digg button.

In loop you can use the following code.For Index.php file or archive.php or category.php you can use following code.


digg_url = '<?php the_permalink() ?>';
digg_title = '<?php the_title() ?>';
</script>

<span><span><span>
<span>0</span><a>digg</a></span></span></span>

In single page and pages or without loop you can use following code in single.php and page.php file. Use the following code.


<script type="text/javascript">// <![CDATA[
(function() { var s = document.createElement('SCRIPT'), <span class="hiddenSpellError" pre="" data-mce-bogus="1">s1</span> = document.getElementsByTagName('SCRIPT')[0]; s.type = 'text/javascript'; s.async = true; s.src = 'http://widgets.digg.com/buttons.js'; s1.parentNode.insertBefore(s, s1); })();
// ]]></script>

You can use various size of digg button in your wordpress site.

For above buttons you need to specify the button size in anchor class. as like following.

<script type="text/javascript">
(function() {
var s = document.createElement('SCRIPT'), s1 = document.getElementsByTagName('SCRIPT')[0];
s.type = 'text/javascript';
s.async = true;
s.src = 'http://widgets.digg.com/buttons.js';
s1.parentNode.insertBefore(s, s1);
})();
</script>
<!-- Medium Button -->
<a class="DiggThisButton DiggMedium"></a>
<!-- Large Button -->
<a class="DiggThisButton DiggLarge"></a>
<!-- Compact Button -->
<a class="DiggThisButton DiggCompact"></a>
<!-- Icon Button -->
<a class="DiggThisButton DiggIcon"></a>

Published by

Purab

I am Purab from India, Software development is my profession and teaching is my passion. Programmers blog dedicated to the JAVA, Python, PHP, DevOps and Opensource Frameworks. Purab's Github Repo Youtube Chanel Video Tutorials Connect to on LinkedIn

3 thoughts on “How to put digg button in wordpress without plugin”

Leave a Reply

Your email address will not be published.