WordPress.org

Make WordPress Core


Ignore:
Timestamp:
08/29/2007 09:10:20 PM (14 years ago)
Author:
ryan
Message:

Include tags in feeds. fixes #4537

File:
1 edited

Legend:

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

    r5910 r5979  
    147147function get_the_category_rss($type = 'rss') {
    148148    $categories = get_the_category();
     149    $tags = get_the_tags();
    149150    $home = get_bloginfo_rss('home');
    150151    $the_list = '';
    151     foreach ( (array) $categories as $category ) {
    152         $cat_name = convert_chars($category->name);
     152    $cat_names = array();
     153
     154    $filter = 'rss';
     155    if ( 'atom' == $type )
     156        $filter = 'raw';
     157
     158    if ( !empty($categories) ) foreach ( (array) $categories as $category ) {
     159        $cat_names[] = sanitize_term_field('name', $category->name, $category->term_id, 'category', $filter);       
     160    }
     161
     162    if ( !empty($tags) ) foreach ( (array) $tags as $tag ) {
     163        $cat_names[] = sanitize_term_field('name', $tag->name, $tag->term_id, 'post_tag', $filter);     
     164    }
     165
     166    $cat_names = array_unique($cat_names);
     167
     168    foreach ( $cat_names as $cat_name ) {
    153169        if ( 'rdf' == $type )
    154170            $the_list .= "\n\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
    155171        if ( 'atom' == $type )
    156             $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', attribute_escape( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attribute_escape( $category->name ) );
     172            $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', attribute_escape( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attribute_escape( $cat_name ) );
    157173        else
    158174            $the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n";
    159175    }
     176
    160177    return apply_filters('the_category_rss', $the_list, $type);
    161178}
Note: See TracChangeset for help on using the changeset viewer.