views:

20

answers:

1

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>
+1  A: 

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']);
Eric Lennartsson
It didn't work. It affects the order without the plugin, so the concept is good, but the plugin seems to still take priority and force it alphabetically. Oh well. Thanks anyway!
Tanya
I just realized you gave me sufficient info to take a completely different approach, so thank you!
Tanya