Exercise: Controlling the post-display count on the frontend

Hire a WordPress Expert on Codeable
Updated On: January 14th, 2025 0 Comments

If you are following along with me, we have published eleven blog posts.

And out of those 11 blog posts, only ten of them are getting displayed on our Homepage:

To display the remaining blog post, WordPress created a second page for our Homepage, and you can access this second page by clicking on the “Older Posts” link at the bottom of the Homepage.

Come on, let’s click on it to go to “Page 2” of our blog posts list:

As expected, WordPress is displaying just the remaining blog post on Page 2.

Also, if you notice, there is a link called “Newer Posts” at the end of Page 2.

Click on it will take us back to “Page 1” where the ten blog posts are displayed.

Nice, right?

We call these “Older Posts” and “Newer Posts” links something called “Pagination” of our blog posts.

The only responsibility of pagination is to help you navigate through blog posts that are split into multiple pages.

But here is a thing.

I do not really like that the 11th blog post is displayed alone on Page 2.

So, I want to remove the second page and display all eleven posts on the first page of the Homepage itself.

How do we achieve this?

Should we have to tinker with the WordPress code?

Bro, Code? I don’t know coding!

Haha, don’t panic.

The solution is way simpler than you think 😀

To achieve our goal, all we have to do is change the “Blog pages show at most” option to 11.

So, go to the “Reading” settings screen inside the Admin Dashboard:

Admin Dashboard -> Settings -> Reading

Now, if you notice, there is an option called “Blog pages show at most” and it is currently set to 10.

This is why the Blog Homepage displays ten blog posts at a time and displays the remaining across multiple pages.

Our goal is to display eleven blog posts at a time on our Blog Homepage, right?

So, set the “Blog pages show at most” option to 11 (eleven) and save the changes.

If you now go back to the Homepage, the pagination got removed, and all eleven posts are getting displayed on the same page:

Nice, right?

But I also feel like the Homepage is looking too big.

I have changed my mind. I only want to display five blog posts at the same time and push the remaining to the second page.

How do I achieve this?

We have to set the “Blog pages show at most” option to five.

Atta boy!

It also impacts the archives and the search results pages

We didn’t talk about the “Archive” and “Search Result” pages yet.

They are similar to the Homepage but list a set of blog posts based on specific criteria.

We will talk about them in future lessons.

For now, I want you to remember that the “Blog pages show at most” setting also controls the blog post count on the “Archive” and “Search Result” pages.

That’s all.

Starting from the next module, we will learn how to manage categories and tags.

Leave a Reply

Your email address will not be published. Required fields are marked *