Changeset 6327

Show
Ignore:
Timestamp:
11/09/07 20:12:04 (1 year ago)
Author:
ryan
Message:

get_category_feed_link() from ionfish. fixes #5173

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-includes/feed.php

    r6274 r6327  
    129129 
    130130 
     131function get_category_feed_link($cat_id, $feed = 'rss2') { 
     132    $cat_id = (int) $cat_id; 
     133     
     134    $category = get_category($cat_id); 
     135     
     136    if ( empty($category) || is_wp_error($category) ) 
     137        return false; 
     138     
     139    $permalink_structure = get_option('permalink_structure'); 
     140 
     141    if ( '' == $permalink_structure ) { 
     142        $link = get_option('home') . "?feed=$feed&cat=" . $cat_id; 
     143    } else { 
     144        $link = get_category_link($cat_id); 
     145        if( 'rss2' == $feed ) 
     146            $feed_link = 'feed'; 
     147        else 
     148            $feed_link = "feed/$feed"; 
     149         
     150        $link = trailingslashit($link) . user_trailingslashit($feed_link, 'feed'); 
     151    } 
     152 
     153    $link = apply_filters('category_feed_link', $link, $feed); 
     154     
     155    return $link; 
     156} 
     157 
     158 
    131159function get_category_rss_link($echo = false, $cat_ID, $category_nicename) { 
    132     $permalink_structure = get_option('permalink_structure'); 
    133  
    134     if ( '' == $permalink_structure ) { 
    135         $link = get_option('home') . '?feed=rss2&cat=' . $cat_ID; 
    136     } else { 
    137         $link = get_category_link($cat_ID); 
    138         $link = trailingslashit($link) . user_trailingslashit('feed', 'feed'); 
    139     } 
    140  
    141     $link = apply_filters('category_feed_link', $link); 
     160    $link = get_category_feed_link($cat_ID, $feed = 'rss2'); 
    142161 
    143162    if ( $echo )