Code WordPress

WordPress Digg Shortcode Function – As Seen on

When moving from, my Digg shortcodes broke.

I wanted a simple way to transition my Digg chicklets to a installation.

I created a function that does nothing special, except for reproducing the Digg shortcode functionality on All you need to do is enter [digg=], and it will create a Digg This chicklet for you. Here’s the code in action →

function kwd_digg_shortcode($content = null) {
    $url = $content[0];
    if( substr($url, 0, 1) == '=') { $url = substr($url, 1); };
    $content = '
    <div class="alignright"> <!-- for layout only; you can modify -->
    <script type="text/javascript"> digg_url = "'.$url.'";</script>
    <script src="" type="text/javascript"></script>
    return $content;
add_shortcode('digg', 'kwd_digg_shortcode');

How to install this on your blog

Simply copy the code above into your theme’s functions.php file. Any existing Digg shortcodes should automatically start working again, and you also will be able to use the functionality as you were doing on the site.

By Zack Katz

Zack Katz is the founder of GravityKit and TrustedLogin. He lives in Leverett, Massachusetts with his wife Juniper.

2 replies on “WordPress Digg Shortcode Function – As Seen on”

Comments are closed.