WordPress creates category "pages" for you
Every so often, I get a support question that goes something like this:
I want a special page on my site that lists posts from only one category. I know I need to create a custom page template for this, but how do I make it load just the posts from my category?
I don’t get asked this too often, but when it does come around, it usually gets asked multiple times in the same week for some reason. The problem is that you don’t have to write any kind of code or create a custom page template. WordPress has already created the page for you. This is called a “category archive.”
WordPress actually creates all kinds of archives. You have taxonomy term archives, author archives, time-/date-based archives, and the potential for many more. So, sometimes these pages already exist and you’re just not aware of them.
How to show the category archive in a menu
Most folks are concerned with adding the category archive to their menu so their visitors can easily find the page. We’re so used to thinking of pages being in the menu that we don’t think of adding other items. In the past, this was pretty much the only choice available without writing some code. However, WordPress’ nav menus system takes care of that.
To add a category archive to one of your menus, go to “Appearance > Menus” in the WordPress admin. Look for the section labeled “Categories.” Then, select the categories you want and add them to your menu.
The following screenshot illustrates what this looks like.
![/user/media/2013/01/nav-menu-categories.png](Screenshot of adding a category to a WordPress nav menu)
Altering the output of the category archive
Some users still want this page to display different data than the other archive-type pages for their special category. That’s easily doable.
To do this, you can create a category-$slug.php
template where $slug
is your category slug. Within that file, you can create anything you want. It’ll overwrite the template your theme normally uses to display category archives.
Keep in mind that many themes do things differently when it comes to templates, so get in touch with your theme author if you need help with this.
If you're using any of my themes or themes built off Hybrid Core, the template name should be taxonomy-category-$slug.php
.