How to Load Older Articles Dynamically Using AJAX in WordPress
Usually, most of the blogging themes come with pagination to view older posts, in this article we have described on how to load older posts dynamically using AJAX. By using AJAX load more button you can load the older articles on the same page instead of new pages which avoids page reload.
Also read:
- 15 Most Useful Online Tools and Generators for Web Developers and Bloggers
- How Secure is Your WordPress Website? Here is Free WordPress Security Checker Tool
How to Load Older Articles Dynamically using AJAX
let’s know how to implement AJAX load more button in WordPress to load older articles without any serious coding. All we need is a tiny WordPress plugin called “Easy Load More”.
Easy Load More plugin let you add AJAX load more button to your blog, when you click on “Load more” button a set of older articles will be loaded on your blog page. Here is the step by step guide to use Easy Load More WordPress plugin-
- Login to your WordPress admin area and go to “Plugins >> Add New”
- Search for Easy Load More plugin developed by Idiom Interactive, install the plugin and activate it
- Once the plugin is activated, go to ‘Settings > Easy Load More’ to setup the plugin
- Now enter your post list wrapper class name or ID in Post List Wrap Selector input box, post list wrapper class is nothing but the div’s class that holds your post loop, check out the image below to clarify-
- Enter the button text such as “Load More Articles”, select the loading animation, button color as well as text color
- Finally, we have to add a function in our theme file to make it work. Navigate to “Appearance >> Editor” and click on Main index template (index.php). Please make sure to backup your index.php file before modifying it so that you can revert it if something goes wrong.
- Add the function <?php load_more_button(); ?> after the post list wrapper (after “post-wrapper” div as shown in the above image)
That’s it, you have just added the AJAX load more button to load older articles in your blog.
hii very good article .
Thanks for sharing keep up the good work.
Thanks for dropping your comment.