Sphinn Wordpress Plugin Mod - Only Display “Sphinn-It” Button for “Sphinn” Tagged Items
Filed under: programming
8
2007
Since my blog has a mix of SEM and non SEM posts, and I still want to post the Sphinn plug in button on them, I did a quick mod that only shows the “Sphinn It” button in the case where you’ve put the tag “Sphinn” in your Wordpress 2.3+ tags list. Feedback welcome. Bold text is new code.
function io_sphinn_it_filter($content)
{
global $wpdb;$sphinnfound=false;
$targettag = “Sphinn”;
$posttags = get_the_tags();
if ($posttags) {
foreach($posttags as $tag) {
if ($sphinnfound=stristr($tag->name,$targettag)){
break;
}
}
}
if ($sphinnfound){// generate $sphinn_it_html based on …
echo ‘<script type=”text/javascript”>submit_url = \”.get_permalink().’\';</script>’;
echo ‘<div align=”right”>’;
echo ‘<script type=”text/javascript” src=”http://sphinn.com/evb/button.php”></script>’;
echo ‘</div>’;
// new content will be added after each post
$content = $content . $io_sphinn_it_html ;
return $content;
}
return($content);
}
If you have an improvement, feel free to shoot ‘em over.
Remember, you have to put “Sphinn” in your post Tags before the button will display.
del.icio.us Digg it ma.gnolia Netscape reddit StumbleUpon Yahoo MyWeb
>
8
2007
Looks like you’ve linked the wrong source for the original. Michelle’s plugin doesn’t have that code but the plugin at this site does:
http://blog.evisibility.com/sphinn-it-plugin-for-wordpress/
8
2007
You’re right! Link fixed.
10
2008
Hi Scott,
Thanks for this awesome change…do you know how I might get the button to appear below my posts rather than above them?
10
2008
yes, you just put the call to the sphinn plug in after the post content is called rather than before. Then align it appropriately.
4
2008
damn! Why my Movable Type Community don’t write such a greate hacks. I started my Blog with Movable Type but now I think it was a mistake. I schould take Wordpress at the start.