Make WordPress Core

source: trunk/wp-rss2.php @ 956

Last change on this file since 956 was 956, checked in by saxmatt, 21 years ago

Migration to get_settings

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 2.1 KB
Line 
1<?php 
2if (! $feed) {
3    $blog = 1;
4    $doing_rss = 1;
5    require('wp-blog-header.php');
6}
7
8header('Content-type: application/rss+xml', true);
9
10/* This doesn't take into account edits
11// Get the time of the most recent article
12$maxdate = $wpdb->get_var("SELECT max(post_date) FROM $tableposts");
13$unixtime = strtotime($maxdate);
14
15// format timestamp for Last-Modified header
16$clast = gmdate("D, d M Y H:i:s \G\M\T", $unixtime);
17$cetag = (isset($clast)) ? md5($clast) : '';
18
19// send it in a Last-Modified header
20header("Last-Modified: " . $clast, true);
21header("Etag: " . $cetag, true);
22*/
23
24?>
25<?php echo '<?xml version="1.0"?'.'>'; ?>
26<!-- generator="wordpress/<?php echo $wp_version ?>" -->
27<rss version="2.0"
28        xmlns:content="http://purl.org/rss/1.0/modules/content/">
29
30<channel>
31        <title><?php bloginfo_rss('name') ?></title>
32        <link><?php bloginfo_rss('url') ?></link>
33        <description><?php bloginfo_rss("description") ?></description>
34        <language><?php echo $rss_language ?></language>
35        <copyright>Copyright <?php echo mysql2date('Y', get_lastpostdate()); ?></copyright>
36        <pubDate><?php echo gmdate('r'); ?></pubDate>
37        <generator>http://wordpress.org/?v=<?php echo $wp_version ?></generator>
38
39        <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
40        <item>
41                <title><?php the_title_rss() ?></title>
42                <link><?php permalink_single_rss() ?></link>
43                <comments><?php comments_link(); ?></comments>
44                <pubDate><?php the_time('r'); ?></pubDate>
45                <author><?php the_author() ?> (mailto:<?php the_author_email() ?>)</author>
46                <?php the_category_rss() ?>
47                <guid isPermaLink="false"><?php echo $id; ?>@<?php bloginfo_rss("url") ?></guid>
48<?php $more = 1; if (get_settings('rss_use_excerpt')) {
49?>
50                <description><?php the_excerpt_rss(get_settings('rss_excerpt_length'), 2) ?></description>
51<?php
52} else { // use content
53?>
54                <description><?php the_content_rss('', 0, '', get_settings('rss_excerpt_length'), 2) ?></description>
55<?php
56} // end else use content
57?>
58                <content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
59        </item>
60        <?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
61</channel>
62</rss>
Note: See TracBrowser for help on using the repository browser.