When you create a new post type in WordPress using register_post_type(), WordPress does not automatically create a page for listing the archives of that post type. It’s possible to create one, though, without too much hassle.
For example, you can create an post type called article, and set the permalink for that post type to articles (i.e., an article will have a URL like http://example.com/articles/my-article-title).
Where do you go for a list of all articles, though? You might assume http://example.com/articles/, but you would be assuming erroneously. You could create a page with the slug articles and use a custom template for that page, but that doesn’t work with paging (e.g., http://example.com/articles/page/2/).
Instead, you need to fiddle with WordPress’s rewrite rules. (And thanks to Andrew Wilson for helping me understand this.)
Continue reading →