WordPress – Force most recent posts first

I want to use the plugin WP Smart Sort to sort my posts alphabetically, except I need the most recent posted first on the home page. The relevant existing code for the home page is below. Is there something I can add to it to force it to include the recent posts and go by date rather than by the alphabetical order I want everywhere else?

(In case it helps to see the context, the site is at http://mormonscholarstestify.org/)

<div id="homebox">

    <?php if ($aOptions['homebox-id'] != '') { query_posts('showposts=5&cat=' . $aOptions['homebox-id']); } ?>
    <?php if(have_posts()) : the_post() ?>

    <div id="boxmain">
        <a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><img src="<?php $key="thumbnail"; echo     get_post_meta($post->ID, $key, true); ?>" alt="<?php the_title() ?>" /></a>
        <h3><a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><?php the_title() ?></a></h3>

<?php $key="affiliation"; echo get_post_meta($post->ID, $key, true); ?><p>

        <?php the_excerpt(); ?>
    </div>

    <?php endif; ?>
    <?php while(have_posts()) : the_post() ?> 

    <div class="boxitem">
        <a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><img src="<?php $key="thumbnail"; echo     get_post_meta($post->ID, $key, true); ?>" alt="<?php the_title() ?>" /></a>
        <h3><a href="<?php the_permalink() ?>" title="<?php the_title() ?>"><?php the_title() ?></a></h3>

<?php $key="affiliation"; echo get_post_meta($post->ID, $key, true); ?>

    </div>

    <?php endwhile; ?>

</div>

Related posts

Leave a Reply

1 comment

  1. According to the WordPress query_posts documentation you should be able to supply an orderby parameter to the querystring to change how the posts are ordered, like so:

    query_posts('showposts=5&orderby=date&order=ASC&cat=' . $aOptions['homebox-id']);