Georgia Lou Studios

Welcome to the Help Center!

Have homepage & archive pages display different post counts

Follow

If you'd like to have one number of posts display on your homepage and a different number of posts display on your archive pages (category page, tag page, author page, etc.), you can follow the steps below.

Open up your "functions.php" theme file-- the easiest way to do this is likely via WP Dashboard > Appearance > Editor > "functions.php". Scroll all the way to the bottom of thedocument.

Copy & paste the following code into the very bottom of this file:

function limit_posts_per_page() {
    if ( is_archive() )
        return 9;
    else
        return 4;
}
add_filter ('pre_option_posts_per_page', 'limit_posts_per_page');

  

Post Number Screenshot

The number value of "9" in the code refers to the number of posts that will display on the archive pages.
The number value of "4" refers to the number of posts that will display on the homepage.

Feel free to change these number values to whatever you prefer. Be sure to save the file when you're finished.

Please note! This function will override whatever you set within Settings > Reading > "Blog pages show at most". If you'd like to change the number of posts that display in the future, you'll want to return and do so within your "functions.php" file.

Was this article helpful?
0 out of 0 found this helpful

Comments

Powered by Zendesk