get_tag() and get_tag_feed_link()

git-svn-id: http://svn.automattic.com/wordpress/trunk@6000 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-09-01 04:43:27 +00:00
parent 0906863d2c
commit a43e37b8a1
2 changed files with 31 additions and 1 deletions

View File

@ -148,6 +148,10 @@ function &get_tags($args = '') {
return $tags;
}
function &get_tag($tag, $output = OBJECT, $filter = 'raw') {
return get_term($tag, 'post_tag', $output, $filter);
}
//
// Cache
//

View File

@ -182,6 +182,32 @@ function the_category_rss($type = 'rss') {
echo get_the_category_rss($type);
}
function get_tag_feed_link($tag_id, $feed = 'rss2') {
$tag_id = (int) $tag_id;
$tag = get_tag($tag_id);
if ( empty($tag) || is_wp_error($tag) )
return false;
$permalink_structure = get_option('permalink_structure');
if ( '' == $permalink_structure ) {
$link = get_option('home') . "?feed=$feed&tag=" . $tag->slug;
} else {
$link = get_tag_link($tag->term_id);
if ( 'rss2' == $feed )
$feed_link = 'feed';
else
$feed_link = "feed/$feed";
$link = $link . user_trailingslashit($feed_link, 'feed');
}
$link = apply_filters('tag_feed_link', $link, $feed);
return $link;
}
function html_type_rss() {
$type = get_bloginfo('html_type');
if (strpos($type, 'xhtml') !== false)
@ -222,4 +248,4 @@ function atom_enclosure() {
}
}
?>
?>