WordPress.org

Make WordPress Core

Ticket #4253: diff

File diff, 3.1 KB (added by RuddO, 7 years ago)

Patch to make category feeds show actually category descriptions and names

  • wp-rss.php

     
    1313<!-- generator="wordpress/<?php echo $wp_version ?>" --> 
    1414<rss version="0.92"> 
    1515<channel> 
    16         <title><?php bloginfo_rss('name') ?></title> 
     16        <title><?php bloginfo_rss('name') ?><?php if (get_query_var('cat')) { print ": ".get_category_name(intval(get_query_var('cat'))); } ?></title> 
    1717        <link><?php bloginfo_rss('url') ?></link> 
    18         <description><?php bloginfo_rss('description') ?></description> 
     18        <description><?php 
     19if (get_query_var('cat')) { 
     20       $cat = get_category(intval(get_query_var('cat'))); 
     21       $desc = $cat->cat_description; 
     22       print $desc; 
     23} else { ?><?php bloginfo_rss('description') ?></description> 
    1924        <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate> 
    2025        <docs>http://backend.userland.com/rss092</docs> 
    2126        <language><?php echo get_option('rss_language'); ?></language> 
  • wp-rss2.php

     
    2020> 
    2121 
    2222<channel> 
    23         <title><?php bloginfo_rss('name'); ?></title> 
     23        <title><?php bloginfo_rss('name'); ?><?php if (get_query_var('cat')) { print ": ".get_category_name(intval(get_query_var('cat'))); } ?></title> 
    2424        <link><?php bloginfo_rss('url') ?></link> 
    25         <description><?php bloginfo_rss("description") ?></description> 
     25        <description><?php 
     26if (get_query_var('cat')) { 
     27        $cat = get_category(intval(get_query_var('cat'))); 
     28        $desc = $cat->cat_description; 
     29        print $desc; 
     30} else { ?><?php bloginfo_rss("description") ?><?php } ?></description> 
    2631        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate> 
    2732        <generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator> 
    2833        <language><?php echo get_option('rss_language'); ?></language> 
  • wp-atom.php

     
    1616        xml:lang="<?php echo get_option('rss_language'); ?>" 
    1717        <?php do_action('atom_ns'); ?> 
    1818> 
    19         <title><?php bloginfo_rss('name') ?></title> 
     19        <title><?php bloginfo_rss('name') ?><?php if (get_query_var('cat')) { print ": ".get_category_name(intval(get_query_var('cat'))); } ?></title> 
    2020        <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" /> 
    21         <tagline><?php bloginfo_rss("description") ?></tagline> 
     21        <tagline><?php bloginfo_rss("description") ?><?php 
     22if (get_query_var('cat')) { 
     23       $cat = get_category(intval(get_query_var('cat'))); 
     24       $desc = $cat->cat_description; 
     25       print $desc; 
     26} else { ?></tagline> 
    2227        <modified><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></modified> 
    2328        <copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog'), 0); ?></copyright> 
    2429        <generator url="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>