Support » Fixing WordPress » Would LIKE to Reverse the Order of “Recent Posts” List

  • Resolved trivum


    I would like to reverse the order of my “recent posts” list in the side bar so that they appear in the original order written — i.e. have the first post written (the oldest) appear at the top of the list instead of at the bottom.

    Any ideas how to do this? Thanks.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Can you show us the code you are using to generate this list?

    Here’s the code:

    <?php wp_get_archives('type=postbypost&limit=10'); ?>

    I was actually able to do what I wanted with the post from a category by putting “&order=asc” into the code, but when I do that with the wp_get_archives it doesn’t seem to work. Here’s the code I used that does what I want it to do with the categories.

    $posts = get_posts('numberposts=10&order=asc&category='. $category->term_id);
    foreach($posts as $post) :

    I’m wondering if I could use the above code but call all the posts and not just the ones from that particular category.

    Yes.. just remove the category declaration in the function

    Great – that did it. Thanks a lot Dragon.

    Final code for anyone else who comes along:

    $posts = get_posts('numberposts=10&order=asc');
    foreach($posts as $post) :

    I’d like to do this, but in the main content section (i.e. someone clicks on a category and the posts appear with the oldest post on top).

    The code currently looks like this:

    <?php while (have_posts()) : the_post(); ?>
    		<div class="post"><h3 id="post-<?php the_ID(); ?>"><a>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    <?php endwhile; ?>


Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Would LIKE to Reverse the Order of “Recent Posts” List’ is closed to new replies.