A Web Development Blog Focused on Code and Technology
Archive for November, 2010
By Karthik Viswanathan on Sunday, November 7th, 2010 | No Comments »
If you use WordPress, you know that after a few months of blogging, there are far too many posts to display simultaneously. To reduce the loading time of your website, you could consider a pagination system, in which you display only a certain number of posts per page. By giving the user the ability to navigate through pages, your posts will all be available and left intact.
Unfortunately, changing the posts per page option under your WordPress reading settings does not automatically create pagination; rather, you have two options:
- Use WordPress’ in-built functions (
next_posts_link) to allow the user to navigate between pages.
- Create your own pagination system.
The main problem with the first option is that WordPress only allows the user to go to the next or previous page; there is no way to jump a set of pages without having to visit everything in-between. Consequently, the bottleneck is in the user-experience.
With the second option, the burden is on the developer. Even though it requires more coding, the user experience is not compromised. As a result, today’s article will focus on how to write your own custom WordPress pagination system. To view a demo, see Lateral Code’s pagination.