Make WordPress Core

Changeset 6000


Ignore:
Timestamp:
09/01/2007 04:43:27 AM (17 years ago)
Author:
ryan
Message:

get_tag() and get_tag_feed_link()

Location:
trunk/wp-includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/category.php

    r5998 r6000  
    149149}
    150150
     151function &get_tag($tag, $output = OBJECT, $filter = 'raw') {
     152    return get_term($tag, 'post_tag', $output, $filter);
     153}
     154
    151155//
    152156// Cache
  • trunk/wp-includes/feed.php

    r5979 r6000  
    183183}
    184184
     185function get_tag_feed_link($tag_id, $feed = 'rss2') {
     186    $tag_id = (int) $tag_id;
     187
     188    $tag = get_tag($tag_id);
     189   
     190    if ( empty($tag) || is_wp_error($tag) )
     191        return false;
     192       
     193    $permalink_structure = get_option('permalink_structure');
     194
     195    if ( '' == $permalink_structure ) {
     196        $link = get_option('home') . "?feed=$feed&tag=" . $tag->slug;
     197    } else {
     198        $link = get_tag_link($tag->term_id);
     199        if ( 'rss2' == $feed )
     200            $feed_link = 'feed';
     201        else
     202            $feed_link = "feed/$feed";
     203        $link = $link . user_trailingslashit($feed_link, 'feed');
     204    }
     205
     206    $link = apply_filters('tag_feed_link', $link, $feed);
     207
     208    return $link;
     209}
     210
    185211function html_type_rss() {
    186212    $type = get_bloginfo('html_type');
Note: See TracChangeset for help on using the changeset viewer.