|
1 <?php |
|
2 /** |
|
3 * RSS2 Feed Template for displaying RSS2 Posts feed. |
|
4 * |
|
5 * @package WordPress |
|
6 */ |
|
7 |
|
8 header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true); |
|
9 $more = 1; |
|
10 |
|
11 echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?> |
|
12 |
|
13 <rss version="2.0" |
|
14 xmlns:content="http://purl.org/rss/1.0/modules/content/" |
|
15 xmlns:wfw="http://wellformedweb.org/CommentAPI/" |
|
16 xmlns:dc="http://purl.org/dc/elements/1.1/" |
|
17 xmlns:atom="http://www.w3.org/2005/Atom" |
|
18 xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" |
|
19 xmlns:slash="http://purl.org/rss/1.0/modules/slash/" |
|
20 <?php |
|
21 /** |
|
22 * Fires at the end of the RSS root to add namespaces. |
|
23 * |
|
24 * @since 2.0.0 |
|
25 */ |
|
26 do_action( 'rss2_ns' ); |
|
27 ?> |
|
28 > |
|
29 |
|
30 <channel> |
|
31 <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title> |
|
32 <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" /> |
|
33 <link><?php bloginfo_rss('url') ?></link> |
|
34 <description><?php bloginfo_rss("description") ?></description> |
|
35 <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate> |
|
36 <language><?php bloginfo_rss( 'language' ); ?></language> |
|
37 <?php |
|
38 $duration = 'hourly'; |
|
39 /** |
|
40 * Filter how often to update the RSS feed. |
|
41 * |
|
42 * @since 2.1.0 |
|
43 * |
|
44 * @param string $duration The update period. |
|
45 * Default 'hourly'. Accepts 'hourly', 'daily', 'weekly', 'monthly', 'yearly'. |
|
46 */ |
|
47 ?> |
|
48 <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', $duration ); ?></sy:updatePeriod> |
|
49 <?php |
|
50 $frequency = '1'; |
|
51 /** |
|
52 * Filter the RSS update frequency. |
|
53 * |
|
54 * @since 2.1.0 |
|
55 * |
|
56 * @param string $frequency An integer passed as a string representing the frequency |
|
57 * of RSS updates within the update period. Default '1'. |
|
58 */ |
|
59 ?> |
|
60 <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', $frequency ); ?></sy:updateFrequency> |
|
61 <?php |
|
62 /** |
|
63 * Fires at the end of the RSS2 Feed Header. |
|
64 * |
|
65 * @since 2.0.0 |
|
66 */ |
|
67 do_action( 'rss2_head'); |
|
68 |
|
69 while( have_posts()) : the_post(); |
|
70 ?> |
|
71 <item> |
|
72 <title><?php the_title_rss() ?></title> |
|
73 <link><?php the_permalink_rss() ?></link> |
|
74 <comments><?php comments_link_feed(); ?></comments> |
|
75 <pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate> |
|
76 <dc:creator><![CDATA[<?php the_author() ?>]]></dc:creator> |
|
77 <?php the_category_rss('rss2') ?> |
|
78 |
|
79 <guid isPermaLink="false"><?php the_guid(); ?></guid> |
|
80 <?php if (get_option('rss_use_excerpt')) : ?> |
|
81 <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> |
|
82 <?php else : ?> |
|
83 <description><![CDATA[<?php the_excerpt_rss(); ?>]]></description> |
|
84 <?php $content = get_the_content_feed('rss2'); ?> |
|
85 <?php if ( strlen( $content ) > 0 ) : ?> |
|
86 <content:encoded><![CDATA[<?php echo $content; ?>]]></content:encoded> |
|
87 <?php else : ?> |
|
88 <content:encoded><![CDATA[<?php the_excerpt_rss(); ?>]]></content:encoded> |
|
89 <?php endif; ?> |
|
90 <?php endif; ?> |
|
91 <wfw:commentRss><?php echo esc_url( get_post_comments_feed_link(null, 'rss2') ); ?></wfw:commentRss> |
|
92 <slash:comments><?php echo get_comments_number(); ?></slash:comments> |
|
93 <?php rss_enclosure(); ?> |
|
94 <?php |
|
95 /** |
|
96 * Fires at the end of each RSS2 feed item. |
|
97 * |
|
98 * @since 2.0.0 |
|
99 */ |
|
100 do_action( 'rss2_item' ); |
|
101 ?> |
|
102 </item> |
|
103 <?php endwhile; ?> |
|
104 </channel> |
|
105 </rss> |