Title: Force most recent posts first
Last modified: August 19, 2016

---

# Force most recent posts first

 *  [tspack](https://wordpress.org/support/users/tspack/)
 * (@tspack)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/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?
 *     ```
       <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>
       ```
   

The topic ‘Force most recent posts first’ is closed to new replies.

## Tags

 * [post order](https://wordpress.org/support/topic-tag/post-order/)
 * [sort](https://wordpress.org/support/topic-tag/sort/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [tspack](https://wordpress.org/support/users/tspack/)
 * Last activity: [15 years, 11 months ago](https://wordpress.org/support/topic/force-most-recent-posts-first/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
