WordPress.org

Ready to get started?Download WordPress

Forums

Put RSS feed in default order (2 posts)

  1. CHUD
    Member
    Posted 9 years ago #

    I wanted my archives and categories to show up in ascending chronological order so I put the following code in my index.php:

    <?php
    if (!empty($_SERVER["QUERY_STRING"]))
    $order="asc";
    /* Short and sweet */
    define('WP_USE_THEMES', true);
    require('./wordpress/wp-blog-header.php');
    ?>

    It worked like a charm, so now my main page has the most recent post up top and goes in descending order but everything else is ascending. Just what I wanted.

    But. Now my RSS feed is in ascending chronological order too, so my oldest entry is what's showing up first. Not what I want there.

    How can I get the RSS to stream normally (reverse chrono order) and still have my archives in ascending order?

  2. Kafkaesqui

    Posted 9 years ago #

    What I would recommend, since you're using custom permalinks, is to remove $order from your blog root index.php, and place this at the end of each of the category and archive RewriteRule lines in your .htaccess:

    &order=asc

    For example:

    RewriteRule ^category/(.+)/?$ /index.php?category_name=$1&order=asc [QSA,L]

    Ignore any of the lines with 'feed' in it...

    Note: Make sure to backup your .htaccess before doing this (in case of a mistype or whatnot).

Topic Closed

This topic has been closed to new replies.

About this Topic