How to add pagination with page numbers rather than next/previous links?

It depends on which pagination you’re talking about:

  • Archive Index pagination
  • Single-Post pagination
  • Comments pagination

In all three cases, the answer is yes, but the implementation is different.

Archive Index Pagination

WordPress provides a function, paginate_links(), for post-archive pagination links. It’s use isn’t exactly straightforward, but fortunately, implementation is mostly cut-and-paste from the Codex example.

Here’s how I use it in Oenology.

Single-Post Pagination

WordPress provides a function, wp_link_pages(), for intra-post pagination links. It’s use is straight-forward, as a normal template tag.

Comments Pagination

WordPress provides a function, paginate_comments_links(), for comments pagination links. This template tag is actually a wrapper for paginate_links(), but its use is straight-forward.