Support » Fixing WordPress » Sort Posts in Ascending Order through wp_get_archives

  • Hello Everyone,

    I’m trying to show post titles ordered in a ascending order so the old posts show first, I used <?php wp_get_archives(‘type=postbypost&order=asc’); ?> which shows the post titles but displays them in descending order. I understand there are some plugins and also some wp_query codes that can be used to achieve this but I just thought there should be a simple way to do this and I don’t see any reason why the above code shouldn’t work. I would really appreciate it if someone could help me out here.


Viewing 5 replies - 1 through 5 (of 5 total)
  • Try wp_get_archives('type=alpha');

    Thanks for helping out but I don’t want to sort posts alphabetically, I want to sort it by date but in an ascending order so old posts will display first.



    Hello everyone,

    I’m having same exact problem. I want to sort the resulting sets by date in ascending order. Any work around for this?

    wp_get_archives() doesn’t seem to support sort.


    Double post. Sorry.

    Here goes. This code snippet shows the 5 latest post titles in ascending order. By changing the number 5 in ‘showposts=5’ you can show any number of posts. (-1 shows all posts).

    <?php query_posts('showposts=5&orderby=post_date&order=ASC'); ?>
    <?php while (have_posts()) : the_post(); ?>
    <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
    <?php endwhile;?>
    <!-- LATEST POSTS END -->
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Sort Posts in Ascending Order through wp_get_archives’ is closed to new replies.