Currently Browsing: Home » 2010 » November

Archive for November, 2010

Under the Hood: Custom WordPress Pagination System

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.

Pagination

Pagination? How?

Unfortunately, changing the posts per page option under your WordPress reading settings does not automatically create pagination; rather, you have two options:

  1. Use WordPress’ in-built functions (posts_nav_link, previous_posts_link and/or next_posts_link) to allow the user to navigate between pages.
  2. 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.

Read the rest of this entry »