WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have searched for this solution on here and was not able to find one that worked for me so I apologize if this seems like a redundant question.

I have several categories that I want to display ONLY the latest post from in order of date/time (regardless of category) on my index.php page.

Please let me know if I can be more specific to help with this answer!

share|improve this question

here is a great way to control the amount of latest posts you wish to show..
This releates to all categories:

$howmanyposts = 1; // here you can set the amout of posts
$wp_query = new WP_Query('post_type=post&posts_per_page='.$howmanyposts.'&paged='.$paged ); 
while ($wp_query->have_posts()) :$wp_query->the_post(); 

    <div class="lastpostHome">
    <h3 id="post-<?php the_ID(); ?>"><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php _e('Permanent Link to', 'your_text_domain'); ?> <?php the_title(); ?>"><?php the_title(); ?></a></h3>
    <div class="metaHome"><small><?php the_time('F jS, Y') ?> <?php the_author() ?> <?php the_category(', ') ?> </small></div>
    <div class="excerptBody"><?php the_excerpt(); ?></div>
    <div class="readmoreHome"><a href="<?php the_permalink() ?>" rel="nofollow"><?php _e('Read More &raquo;', 'your_text_domain'); ?></a></div>

<?php endwhile; ?>
  • Please Note That this would show the excerpt and not the full post..
    if you wish to show the full post change "the_excerpt" to "the_content" in the code

Hope this helps..
Cheers, Sagive

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.