This is a terribly simple but useful WordPress plugin that puts an interactive counter-style Reddit interface on your blog — but only when someone has already bookmarked the URL.  It looks rather lame when everything isn't bookmarked, but the JavaScript interface with the arrows is a definate enhancement over a simple icon.  So why not show it only when applicable?  I'll narcissistically bookmark this post to demonstrate.  Just call the function "reddit_this()" and specify one of the styles enumerated here.  Enjoy!

<?

/*
Plugin Name: Reddit
Plugin URI: http://www.seoegghead.com/
Description: Creates an interactive Reddit button.
Author: Jaimie Sirovich
Version: 1.0
Author URI: http://www.seoegghead.com/
*/ 

function reddit_this($reddit_style 1)
{
    global 
$id;
    
$reddit_link get_post_meta($id'REDDIT_CLASS_reddit_link'true);
    
    if (!
is_home() && !$reddit_link && preg_match('#reddit.com#i'$_SERVER['HTTP_REFERER'])) { 
        
add_post_meta($id'REDDIT_CLASS_reddit_link'$_SERVER['HTTP_REFERER']);
        
$reddit_link $_SERVER['HTTP_REFERER'];
    }

    if ($reddit_link) {
        
?><script>reddit_url='<?php the_permalink() ?>'</script><script language="javascript" src="http://reddit.com/button.js?t=<?=$reddit_style?>"></script><?
    
}
    
}

?>

Tell an amigo:
  • Sphinn
  • Digg
  • Reddit
  • del.icio.us
  • StumbleUpon
  • Facebook



Related posts:
How To Get Dugg More: Digg for WordPress Plugin So I got Dugg — but I'm convinced this trivial...
Updated PagerFix Plugin Code For WP 2.1 I upgraded to WordPress 2.1 today, and one of my...
WP HTML Taint Check <? /*Plugin Name: HTMLTaintCheckPlugin URI: http://www.seoegghead.com/Description: Checks for suspicious links in posts. MAKE SURE TO REPLACE YOUR EMAIL ADDRESS IN...
Stop Hackers With Our WordPress Firewall Plugin v1.2 Getting hacked is a total bummer, right? Right. But...
WordPress "SEO Pager" Pagination Control Plugin Released! You like SEO and intuitive pagination controls? Well, we decided...