How to limit number of posts on your WordPress homepage.
If you have been blogging regularly for more than few months, chances are you have quite a few posts on your blog. That is a good thing. As a blogger you are supposed to blog regularly to provide useful and relevant information to your blog readers. But unless you dictate how your homepage is displayed WordPress will display several posts (or excerpts of posts) on the homepage. Usually you don’t want to display all your posts on the front page. So how do you tell WordPress to display only a certain number of posts on the front page? The answer is simple.
You can certainly use a plugin to limit the number of posts on the front page, but if you are comfortable with editing a PHP file then you can accomplish this task yourself without installing a plugin.
All you need to do is to add following code before the loop statement in the index.php file of your theme.
//Set limit of posts on the front page to 8.
A word of advice: Make a backup of your index.php file before editing, just in case you need to revert to the original file.
Open index.php in a text editor of your choice or in WordPress. Search for the line