Do you want to add a load more posts button in WordPress? Many popular platforms allow users to load more posts when they reach to the bottom of the page, and for good reason.
In our experience, this simple button can significantly improve the user experience. Rather than clicking through multiple pages, users can instantly load new content without interrupting their browsing flow.
In this article, we’ll show you how to easily add a load more posts button in WordPress.
When and Why Add Load More Posts Button in WordPress
Keeping your users engaged with the content helps you get more views and ultimately more subscribers.
Many blogs use the simple ‘Older posts’ navigation link at the end of their home, blog, and archive pages. Some websites use numeric page navigation which adds more context.
However, there are certain type of websites that can benefit immensely from infinite scroll or load more posts button. Some examples include photography websites, listicles, and viral content websites.
Instead of loading a whole new page, ‘load more posts’ button works like infinite scroll. It uses JavaScript to quickly fetch the next set of content. This improves user experience and gives them a chance to view more of your content.
That being said, let’s take a look at how to easily add load more posts button in your WordPress site.
Adding Load More Posts Button in WordPress
The first thing you need to do is install and activate the Ajax Load More plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
Upon activation, the plugin will add a new menu item labeled ‘Ajax Load More’ to your WordPress admin menu. You need to click on it and head over to the plugin’s settings page.
On the settings page, you can choose the color of your button. You can also replace the button with infinite scroll which loads next batch of posts automatically without users clicking on the button.
Next, you need to visit Ajax Load More » Repeater Template page to add your template for displaying posts.
The plugin comes with a basic template containing the WordPress loop to display posts. However, it does not match your theme and may look out of place on your website.
To fix this, you need to copy the code your theme uses to display posts on index, archive, and blog pages.
Normally, this code is located in the template-parts folder of your theme. In that folder, you will see templates to display different content. For example content-page.php, content-search.php, and more.
You will be looking for the generic content.php template. Here is an example from our demo theme’s content.php file: