Support » Fixing WordPress » Reverse results of Archive query?

  • Resolved nothingdepartment

    (@nothingdepartment)


    Does anyone know how I can change this code to display the oldest results first instead of the newest?

    <?php $archive_query = new WP_Query('showposts=1000');
    while ($archive_query->have_posts()) : $archive_query->the_post(); ?>
         <a href="<?php the_permalink() ?>"><?php the_title(); ?></a><br />
    <?php endwhile; ?>

    Thanks!

Viewing 2 replies - 1 through 2 (of 2 total)
  • I think you need to change your $archive_query to (only the first line changes, the rest of the code stays the same):

    <?php $archive_query = new WP_Query( array ( 'showposts' => '1000', 'orderby' => 'date', order' => 'ASC' ) );
    while...
    nothingdepartment

    (@nothingdepartment)

    Thank you so much! I read about that attribute but didn’t know how it gets implemented. That worked perfectly.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Reverse results of Archive query?’ is closed to new replies.