azizhp
By: a guest | Aug 21st, 2009 | Syntax:
PHP | Size: 1.34 KB | Hits: 1,319 | Expires: Never
<?php
/*
Plugin Name: AHP Tags to Hashtags
Plugin URI: http://metablog.us
Description: when active, automatically appends all tags to the post as hashtags to the post title in the output RSS feed.
Version: 1.0
Author: Aziz H. Poonawalla
Author URI: http://metablog.us
Copyright 2009 AZIZ POONAWALLA (email : APOONAWA dash BLOG at YAHOO dot COM)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
*/
function ahp_tags2hashtags($title) {
$taglist = "";
$posttags = get_the_tags();
if ($posttags) {
# for each tag,
foreach($posttags as $tag) {
# get tag name
$tagname = $tag->name;
# remove spaces from tag
# prepend # symbol and append to hashtag list
$taglist = $taglist . " #" . $tagname;
}
}
$title = $title . $taglist;
return $title;
}
add_filter('the_title_rss', 'ahp_tags2hashtags');
?>