Support » Fixing WordPress » RSS2 feed

  • I have <pre>
    <?php echo ‘<?xml version=”1.0″?’.’>’; ?>
    <?php
    $blog = 1;
    $doing_rss = 1;
    header(‘Content-type: text/xml’, true);
    require(‘wp-blog-header.php’);
    /* This doesn’t take into account edits
    // Get the time of the most recent article
    $maxdate = $wpdb->get_var(“SELECT max(post_date) FROM $tableposts”);
    $unixtime = strtotime($maxdate);
    // format timestamp for Last-Modified header
    $clast = gmdate(“D, d M Y H:i:s \G\M\T”, $unixtime);
    $cetag = (isset($clast)) ? md5($clast) : ”;
    // send it in a Last-Modified header
    header(“Last-Modified: ” . $clast, true);
    header(“Etag: ” . $cetag, true);
    */
    if (!isset($rss_language)) { $rss_language = ‘en’; }
    if (!isset($rss_encoded_html)) { $rss_encoded_html = 0; }
    if (!isset($rss_excerpt_length) || ($rss_encoded_html == 1)) { $rss_excerpt_length = 0; }
    ?>
    <rss version=”2.0″
    xmlns:content=”http://purl.org/rss/1.0/modules/content/”>
    <channel>
    <?php $items_count = 0; if ($posts) { foreach ($posts as $post) { start_wp(); ?>
    <item>
    <content:encoded><?php the_content(”, 0, ”) ?></content:encoded>
    </item>
    <?php $items_count++; if (($items_count == $posts_per_rss) && empty($m)) { break; } } } ?>
    </channel>
    </rss>
    </pre>
    but I want it only to show the latest piece of news.

  • You must be logged in to reply to this topic.