Technorati tags within . Use to use a different tag word than what's between the tags. Will also allow adding 'ttag' custom values for the post for listing at the end of each post and/or 'ttaglist' of comma seperated words.
Version: 1.2.4
Author: Keith McDuffee
Author URI: http://www.gudlyf.com
*/
$ttag_image = get_settings('siteurl') . '/wp-content/plugins/technobubble.gif';
$ttag_image_small = get_settings('siteurl') . '/wp-content/plugins/technosquare.gif';
$ttag_link = "http://www.technorati.com/tag/";
$ttag_alt = "Technorati Tag";
function technotag($text) {
global $ttag_image_small, $ttag_link;
$long_pattern = '/(.*?)<\/ttag>/i';
$short_pattern = '/(.*?)<\/ttag>/i';
preg_match ($long_pattern, $text , $my_long);
preg_match ($short_pattern, $text , $my_short);
$text = preg_replace($long_pattern,'$2
',$text);
$text = preg_replace($short_pattern,'$1
',$text);
return $text;
}
function ttags($text) {
global $ttag_image, $ttag_link;
$ttaglist = get_post_custom_values('ttaglist');
$ttagvals = get_post_custom_values('ttag');
if(!empty($ttaglist)) {
$ttags = preg_split("/[\s,]+/", $ttaglist[0]);
$ttags = array_merge($ttags, $ttagvals);
} else {
$ttags = $ttagvals;
}
if(!empty($ttags)) {
$ttags_list = '';
$ttags_list = $ttags_list . '
';
foreach ($ttags as $ttag) {
$ttag_nospace = str_replace(" ", "+", $ttag);
$ttags_list = $ttags_list . ''.$ttag.', ';
}
$ttags_list = rtrim($ttags_list, ", ");
$ttags_list = $ttags_list . '';
$text = $text . $ttags_list;
}
return $text;
}
add_filter('the_content', 'technotag');
add_filter('the_content', 'ttags');
add_filter('comment_text', 'technotag');
?>