BuzzMaven Internet Marketing ConsultantScott Clark Web Marketing Consultant
1-859-951-4414 or 1-888-668-4393
Lexington metro area: 1-859-268-0664
...or use my online form anytime

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

by Scott Clark on November 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.

Bookmark and Share

{ 5 comments… read them below or add one }

Caroline Middlebrook 11.08.07 at 10:49 am

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/

Scott Clark 11.08.07 at 10:53 am

You’re right! Link fixed.

Failure Sucks! 01.10.08 at 1:04 am

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?

Scott Clark 01.10.08 at 7:20 am

yes, you just put the call to the sphinn plug in after the post content is called rather than before. Then align it appropriately.

Lernen 03.04.08 at 6:40 pm

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 Comment

You can use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>