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!

link|improve this question
feedback

1 Answer

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

<?php 
$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>
    </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

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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