daily gadgets, computers, and electronic news
24/07
2005

Extending HeadMeta Plugin with Bunny’s Technorati Tag Plugin

Sponsored Links

If you’re using both HeadMeta plugin and Bunny’s Technorati Tags plugin for your Wordpress blog, you can extend the HeadMeta to make it work with the technorati tags from Bunny’s.

HeadMeta Description: This plugin allows you to add < meta> and < link> tags to the < head> based on post custom fields. Use keys named “head_meta” and “head_link”. Also, if you have a custom field named “keyword” or “keywords”, it will automatically generate a standard < meta name="keywords" content="whatever" /> tag, which some search engines will use for indexing.

Bunny’s Technorati Tag Description: Allows easy addition to a post of a space-separated list of tags which can be displayed with adequate Technorati links in the template. Can display keywords instead if no tags are available.

One of the HeadMeta plugin’s feature is to automatically create keywords meta tag for any single post if you add the keyword custom field on your post. Those keywords are useful to get better placement on several popular search engine, including Google and Yahoo. Bunny’s Technorati Tags plugin is also working with keyword. Not with meta tag, but with the technorati tag. By installing this plugin, you can supply keywords for your post, and they will be automatically converted into technorati tags. Adding technorati tags guarantee your blogs to get more and more visitors.

By using the following simple hack, you can make the HeadMeta plugin to work with the keywords you’ve previously supplied for the Bunny’s Technorati tags.

First, it is recommended to modify the Bunny’s plugin to make it work with multiple words tag. The default only support one word per tag. Use WP plugin editor and change output_bunny_tags function to the following. (Sorry, I can’t find the original source and credit for this modification, if someone know about it, please let me know)

// prepare formatted tag list from $tags_array
function output_bunny_tags($tags_array, $before, $after, $separator)
{
if(!empty($tags_array))
{
$tags_list=$before; // HTML to display before the list of tags
foreach($tags_array as $tag) // go through all tags for the post
{
$tag_link='‘ . $separator; // make a link to the technorati tag page, with tag link text
$tags_list.=$tag_link; // stick it on the end of the growing list
}
$chomp = 0 - strlen($separator);
$tags_list=substr($tags_list, 0, $chomp);// remove the last separator
$tags_list.=$after; // HTML to display after the list of tags
}
return($tags_list); // return the nice little html-ized list of technorati tags
}

To use multiple word tags, simply use ‘+’ as separator. For example:

web website search+engine online+search

Now, open HeadMeta plugin. Find this line:

$keywords = array_merge($post_meta_cache[$id]['keyword'], $post_meta_cache[$id]['keywords']);

and change it to:

$keywords = array_merge($post_meta_cache[$id]['keyword'], $post_meta_cache[$id]['keywords'], $post_meta_cache[$id]['tags']);

This $post_meta_cache[$id]['tags'] will make the HeadMeta to grab the keywords owned by Bunny’s Technorati Tags plugin. Just it, save and you’re done.

What if you want to add several default keywords for your meta tag? Open the HeadMeta plugin again, find the following code:

if (count($keywords)) {
$keys = implode(',',$keywords); // stitch multiples together
$keys = wp_specialchars($keys);
$keys = str_replace("+"," ",$keys);
$tag = "“;
print “$tag\n”;
}

and replace with:

$defkeys = "enter your default keywords here";
if (count($keywords)) {
$keys = implode(',',$keywords); // stitch multiples together
$keys = wp_specialchars($keys);
$keys = str_replace("+"," ",$keys);
$tag = "“;
print “$tag\n”;
}

Again, save it and finish :)

I haven’t use this hack on this site, instead, I use it on my other blogs, here and here. Go there, open any post, and view the source if you want to see the result :))

Extending HeadMeta Plugin with Bunny’s Technorati Tag Plugin is written by cosa and posted under Crack & Hack, WordPress , , , . If you like it, you might consider subscribing to our feed or receive our latest posts via email. Or else, you could also bookmark it to your favourite social bookmark sites. Further information about this article can be found .

1 Comment (leave yours)

No comments yet.

Leave a comment