Support » Fixing WordPress » RSS is Backwards!

  • My RSS feed shows my first ever post and up from there… Which is a little troubling 🙁 Since my feed only shows 10 posts, it will appear as if I havent made any updates!

    I *did* change how pages are displayed in the code (changed an ASC to a DESC somewhere) so that *todays* posts are displayed in the order the are posted… but the RSS code seems to use a deprecated method of displaying stuffs.

    Any hints on how to fix this?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Could you clarify where you changed “an ASC to a DESC somewhere?”

    WordPress is set by default to sort in DESCending order, so changing to DESC seems out of…sorts.

    Line 468 of Classes.php – It used to be “DESC” and I changed it to “ASC” there. Sorry, had it backwards 🙂

    Reasoning behind the line 468 change was that I have a blog, which is updated daily. I want only the current days’ articles posted, in the order they were posted.

    Changing that DESC to ASC made it work perfectly the way I wanted it to, and methinks it’s what has also reversed the RSS displayage.

    A couple solutions to this. I’ll let you decide which works best for you.

    First, a plugin:

    With it you can set home (or any query type) to display the last day’s worth of posts in ASCending order.

    Second, a somewhat geeky use of query_posts(). You’d insert this into your theme template before The Loop:

    $query = $wpdb->get_var("SELECT post_date FROM $wpdb->posts WHERE post_status = 'publish' ORDER BY post_date DESC LIMIT 1");
    $query = str_replace('-', '', substr($query,0,10));
    query_posts('m=' . $query . '&showposts=-1&order=ASC');
    $wp_query->is_archive = false; $wp_query->is_home = true;

    Here’s what’s going on in it: $query is the value of a sql query which collects the post_date for the last *published* post. Through a bit of PHP magic we convert post_date (ex: 2006-02-01 12:00:01) to the format needed for the ‘m’ (archive) query (ex: 20060201). The query_posts() arguments should be self-explanatory; -1 for ‘showposts’ tells WP to display all post in the query select. Finally, passing ‘m’ through query_posts() can bobble the query type of the page we’re on, so the $wp_query statements make sure these are what’s expected.

    The plugin method is definitely easier. :)

    I opted for the sexy code ninja method, but failed due to implications of my deeply hacked and jury-rigged WordPress install.

    The Plugin *almost* did the trick, but I suppose any further Q&A on that should be directed towards that plugin author 😉 Thx alot!

    (for reference: CQS plugin doesn’t have the ability to display the latest date’s posts sorted ASCendingly, as sorting by date ASC will bring up your FIRST ever post instead of the first post for the last day. 🙂

    CQS plugin doesn’t have the ability to display the latest date’s posts sorted ASCendingly

    Sure about that? I tested before posting on the plugin (and just tested again) and a setting of


    1 days

    Order By:
    date ASC

    For me displays the last day’s worth of posts in ascending order. When I publish a new post, the new post/day appears.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘RSS is Backwards!’ is closed to new replies.