root/trunk/wp-includes/feed-rss2.php

Revision 7244, 2.0 kB (checked in by westi, 4 months ago)

Better self links for feeds. Fixes #5238 props andy.

  • Property svn:eol-style set to native
Line 
1 <?php
2 /**
3  * RSS2 Feed Template for displaying RSS2 Posts feed.
4  *
5  * @package WordPress
6  */
7
8 header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
9 $more = 1;
10
11 ?>
12 <?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
13
14 <rss version="2.0"
15     xmlns:content="http://purl.org/rss/1.0/modules/content/"
16     xmlns:wfw="http://wellformedweb.org/CommentAPI/"
17     xmlns:dc="http://purl.org/dc/elements/1.1/"
18     xmlns:atom="http://www.w3.org/2005/Atom"
19     <?php do_action('rss2_ns'); ?>
20 >
21
22 <channel>
23     <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>
24     <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />
25     <link><?php bloginfo_rss('url') ?></link>
26     <description><?php bloginfo_rss("description") ?></description>
27     <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></pubDate>
28     <?php the_generator( 'rss2' ); ?>
29     <language><?php echo get_option('rss_language'); ?></language>
30     <?php do_action('rss2_head'); ?>
31     <?php while( have_posts()) : the_post(); ?>
32     <item>
33         <title><?php the_title_rss() ?></title>
34         <link><?php the_permalink_rss() ?></link>
35         <comments><?php comments_link(); ?></comments>
36         <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
37         <dc:creator><?php the_author() ?></dc:creator>
38         <?php the_category_rss() ?>
39
40         <guid isPermaLink="false"><?php the_guid(); ?></guid>
41 <?php if (get_option('rss_use_excerpt')) : ?>
42         <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
43 <?php else : ?>
44         <description><![CDATA[<?php the_excerpt_rss() ?>]]></description>
45     <?php if ( strlen( $post->post_content ) > 0 ) : ?>
46         <content:encoded><![CDATA[<?php the_content() ?>]]></content:encoded>
47     <?php else : ?>
48         <content:encoded><![CDATA[<?php the_excerpt_rss() ?>]]></content:encoded>
49     <?php endif; ?>
50 <?php endif; ?>
51         <wfw:commentRss><?php echo get_post_comments_feed_link(); ?></wfw:commentRss>
52 <?php rss_enclosure(); ?>
53     <?php do_action('rss2_item'); ?>
54     </item>
55     <?php endwhile; ?>
56 </channel>
57 </rss>
58
Note: See TracBrowser for help on using the browser.