WordPress is an extremely powerful CMS out of the box (I know you already know that). And coupled with some really awesome plugins, you can really rock your niche. What you may not be aware of is how you can further customize your theme and add some great additional content to your site using custom category pages.
This example is going to cover creating custom category pages (although you can do the same thing with tags, authors, or other archive pages).
Understanding WordPress Template Hierarchy
WordPress uses an amazingly logical method for determining the order of PHP template files to process and display the page the viewer is requesting.
For example, if a visitor is attempting to view a category archive page on your site, WordPress automagically (actually it’s the is_category() function) goes through your theme folder and looks for the following template files, in this order, and stops when it finds one that matches:
category-slug.php » category-id.php » category.php » archive.php » index.php
- category-slug.php = where “slug” matches the slug of your page, this template can be used to control the content, layout, design, etc. of just that category
- category-id.php = where “id” matches the WordPress ID for this page, same as above except using the category “id” instead of its “slug”
- category.php = can be used to handle the display of all category archives
- archive.php = most themes use this file to manage all archive types
- index.php = if WordPress can’t find any other matching template file, it uses this one as a last resort
Other archive template page hierarchy is very similar.
Let’s get more specific. If WordPress determines the user is attempting to view the archive for your category of “Sushi Restaurants” (assume your slug here is “sushi-restaurants” and has an ID of “38”) it will look for the following theme template pages:
category-sushi-restaurants.php » category-38.php » category.php » archive.php » index.php
If you didn’t already know this and aren’t already scheming up ideas for your WordPress sites, you may have missed the point. The option to create category/tag-level custom pages give you a layer of granular control you can use to build archive pages targeted for the specific (or broad) key phrases around your “Category”.
By default most themes (premium or free) apply the same styles to every archive page (tags, categories, authors, dates, etc.) using either “archive.php” or “index.php”. You can do so much more.
Putting It To Practical Use
Now that you see the potential here, what do you do?
First thing is you’ll want to look in your theme folder and see if you have a category.php or archive.php file. You’ll want to use whichever appears first in the above hierarchy.
If you don’t have either, you’ll start with the index.php file. Let’s assume the archive.php file is the highest in the hierarchy for you. Open it with your favorite HTML editor and save a copy as “category.php”. This will be your starting point. (If you already have a category.php file, skip this first step.)
You can customize your new category.php file if you wish. We’ll use it as the default way WordPress handles your category display. Now figure out which category you want to work with first, and save a copy of the category.php as category-your-slug.php. Now you should have “category-your-slug.php”, “category.php” and “archive.php”.
Assuming we’re still using the “Sushi Restaurants” category from above, we could do several things. At the top of the HTML content column, we could add a photo of a sushi plate with some search optimized text below it to introduce the posts that will appear on the page. Why not also add a nice meta description for the SERPs and maybe just display your post excerpts in the WordPress Loop rather than the whole post.
Get the idea? The point is, with some link building and a little extra work, you may just find you have new, very targeted pages on your site start ranking for “Sushi Restaurant Reviews” or whatever long or short tail you’re going after.
They’ve Already Done It
Here are some examples of folks who have already started using custom archive pages. Check out how they have added custom content related to their categories:
- SugarRae’s Affiliate Marketing category page
Rae makes great use of the category template to add custom content at the top, links and even a related video.
- Smashing Magazine’s Graphics category page
Give It A Try Yourself
Drop a link in the comments and let us see what you’ve been able to do on your own WordPress site with template pages.
And finally, if you really want to get fancy and dig into this subject, I suggest the WordPress Template Hierarchy page as a great place to get started: http://codex.wordpress.org/Template_Hierarchy.
I hope you find this tutorial helpful. This (honestly) just skims the surface of what you can do with WordPress beyond installing plugins. Enjoy!
Marty Martin is an accomplished SEM/SEO anti-consultant with a broad range of experience working for a wide variety of clientele including colleges and universities, regional and state tourism, government and business.
An advocate for small business, Marty works hard to share accurate information in a world suddenly overrun with “social media consultants.”