TechnoTag: technotag.php

File technotag.php, 1.8 kB (added by wpplugins@redune.com, 3 years ago)

I modified the plugin so that you can add tags that are seperated by commas or spaces. Just add a custom field named "taglist" and enter the tags like this "tags technorati wordpress"

Line 
1 <?php
2 /*
3 Plugin Name: TechnoTag
4 Plugin URI: http://www.gudlyf.com/archives/2005/01/14/wordpress-plugin-technotag/
5 Description: Allows <a href="http://www.technorati.com/help/tags.html">Technorati tags</a> within &lt;tag&gt; &lt;/tag&gt;.  Use &lt;tag word="tag word"&gt; 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.
6     Also uses all tags that are in the taglist custom field which are seperated by commas or spaces
7 Version: 1.2
8 Author: Keith McDuffee
9 Author URI: http://www.gudlyf.com
10
11 Modified by: William Spaetzel
12 Modifier URL: http://www.redune.com
13 */
14
15 function technotag($text) {
16
17
18     $image = get_settings('siteurl') . '/wp-content/plugins/technobubble.gif';
19
20     $link = "http://www.technorati.com/tag/";
21     $text = preg_replace('/<ttag word="(.*?)">(.*?)<\/ttag>/i','<a href="' . $link . '$1" rel="tag">$2<img border="0" src="' . $image . '" /></a>',$text);
22     $text = preg_replace('/<ttag>(.*?)<\/ttag>/i','<a href="' . $link . '$1" rel="tag">$1<img border="0" alt="Technorati Tag" src="' . $image . '" /></a>',$text);
23
24     $taglist = get_post_custom_values('taglist');
25
26     $ttags = preg_split("/[\s,]+/", $taglist[0]);
27
28     $ttagvals = get_post_custom_values('ttag');
29
30     $ttags = array_merge($ttags, $ttagvals);
31
32     $ttags_list = '';
33
34     
35     if(!empty($ttags)) {
36
37         $ttags_list = '<span class="ttag">';
38         $ttags_list = $ttags_list . '<img src=' . $image . ' alt="Technorati Tags" /> ';
39
40         foreach ($ttags as $ttag) {
41             $ttags_list = $ttags_list . '<a href="' . $link . $ttag . '" rel="tag">'.$ttag.'</a>';
42             $ttags_list = $ttags_list . '&nbsp;&nbsp';
43         }
44     
45         $ttags_list = $ttags_list . '</span>';
46     }
47
48     $text = $text . $ttags_list;
49
50     return $text;
51 }
52
53 add_filter('the_content', 'technotag');
54 add_filter('comment_text', 'technotag');
55
56 ?>
57