Ticket #4253: diff

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

Patch to make category feeds show actually category descriptions and names

Line 
1Index: wp-rss.php
2===================================================================
3--- wp-rss.php  (revisión: 32)
4+++ wp-rss.php  (copia de trabajo)
5@@ -13,9 +13,14 @@
6 <!-- generator="wordpress/<?php echo $wp_version ?>" -->
7 <rss version="0.92">
8 <channel>
9-       <title><?php bloginfo_rss('name') ?></title>
10+       <title><?php bloginfo_rss('name') ?><?php if (get_query_var('cat')) { print ": ".get_category_name(intval(get_query_var('cat'))); } ?></title>
11        <link><?php bloginfo_rss('url') ?></link>
12-       <description><?php bloginfo_rss('description') ?></description>
13+       <description><?php
14+if (get_query_var('cat')) {
15+       $cat = get_category(intval(get_query_var('cat')));
16+       $desc = $cat->cat_description;
17+       print $desc;
18+} else { ?><?php bloginfo_rss('description') ?></description>
19        <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>
20        <docs>http://backend.userland.com/rss092</docs>
21        <language><?php echo get_option('rss_language'); ?></language>
22Index: wp-rss2.php
23===================================================================
24--- wp-rss2.php (revisión: 32)
25+++ wp-rss2.php (copia de trabajo)
26@@ -20,9 +20,14 @@
27 >
28 
29 <channel>
30-       <title><?php bloginfo_rss('name'); ?></title>
31+       <title><?php bloginfo_rss('name'); ?><?php if (get_query_var('cat')) { print ": ".get_category_name(intval(get_query_var('cat'))); } ?></title>
32        <link><?php bloginfo_rss('url') ?></link>
33-       <description><?php bloginfo_rss("description") ?></description>
34+       <description><?php
35+if (get_query_var('cat')) {
36+       $cat = get_category(intval(get_query_var('cat')));
37+       $desc = $cat->cat_description;
38+       print $desc;
39+} else { ?><?php bloginfo_rss("description") ?><?php } ?></description>
40        <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
41        <generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator>
42        <language><?php echo get_option('rss_language'); ?></language>
43Index: wp-atom.php
44===================================================================
45--- wp-atom.php (revisión: 32)
46+++ wp-atom.php (copia de trabajo)
47@@ -16,9 +16,14 @@
48        xml:lang="<?php echo get_option('rss_language'); ?>"
49        <?php do_action('atom_ns'); ?>
50 >
51-       <title><?php bloginfo_rss('name') ?></title>
52+       <title><?php bloginfo_rss('name') ?><?php if (get_query_var('cat')) { print ": ".get_category_name(intval(get_query_var('cat'))); } ?></title>
53        <link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
54-       <tagline><?php bloginfo_rss("description") ?></tagline>
55+       <tagline><?php bloginfo_rss("description") ?><?php
56+if (get_query_var('cat')) {
57+       $cat = get_category(intval(get_query_var('cat')));
58+       $desc = $cat->cat_description;
59+       print $desc;
60+} else { ?></tagline>
61        <modified><?php echo mysql2date('Y-m-d\TH:i:s\Z', get_lastpostmodified('GMT'), false); ?></modified>
62        <copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate('blog'), 0); ?></copyright>
63        <generator url="http://wordpress.org/" version="<?php bloginfo_rss('version'); ?>">WordPress</generator>