How to show only your single latest post on your Wordpress home page.
In Wordpress 2.x under Settings > Reading, you can set a number for “Blog pages show at most”. This applies globally, however. I discovered a method to make your home page to show only the latest post, while allowing all other blog pages to respect the “at most” number.
In index.php, just before the loop, I added the following line:
<?php query_posts('showposts=1'); ?>
Basically, that sets up a preemptive query and grabs only the latest post, rather than allowing the loop to query the latest “at most” number of posts.
Popularity: 52% [?]












Leave a Comment