• 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.

    Thanks,
    RJ_Dev

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

    Thread Starter RJ_Dev

    (@rj_dev)

    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.

    Thanks,
    Fred

    larsjo

    (@larsjo)

    Double post. Sorry.

    larsjo

    (@larsjo)

    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).

    <!-- LATEST POSTS START -->
    <?php query_posts('showposts=5&orderby=post_date&order=ASC'); ?>
    <ul>
    <?php while (have_posts()) : the_post(); ?>
    <li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
    <?php endwhile;?>
    </ul>
    <!-- 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.