HomeAboutArchivesMy FirmSubscribe to my FeedContactLinked InLinked In

Sphinn Wordpress Plugin Mod - Only Display “Sphinn-It” Button for “Sphinn” Tagged Items

Filed under: programming

Nov
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.

Posted by Scott Clark @ 7:50 am  


Mixx This Story

del.icio.us Digg it ma.gnolia Netscape reddit StumbleUpon Yahoo MyWeb

5 Responses to “Sphinn Wordpress Plugin Mod - Only Display “Sphinn-It” Button for “Sphinn” Tagged Items”

  1. Nov
    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/

  2. Nov
    8
    2007

    You’re right! Link fixed.

  3. Jan
    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?

  4. Jan
    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.

  5. Mar
    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.

Leave a Reply



Original Design by Swank Revised Header Designed by Scott Clark| Powered by Wordpress 2.5.1

| Scott Clark