Easily Apply Templates to Your WordPress Category Pages

You may know that you can create templates for your category pages in order to make them unique. For example, if you have a category titled “Music,” you can make a template for that category (category-music.php) that you can then style differently.

But what if you had five categories that you wanted to look one way, five other categories you wanted to look another, and then five more you wanted to look yet another. Even though you only had three different designs, you would need to make fifteen separate category templates, one for each category.

A Simpler Solution

Luckily, there’s a simpler solution – a plugin called Custom Category Templates that lets you create multiple category templates that you can apply over and over again as you would a Page template.

So in our example above, instead of making fifteen different templates, you would only need to make three, and then apply the correct template to the correct categories.

Featured Plugin - WordPress Membership Site Plugin

If you're thinking about starting a paid, or just private, membership site then this is truly the plugin you've been looking for. Easy to use, massively configurable and ready to go out of the box!
Find out more

How to Make a Category Template in 4 Steps

The plugin itself is very simple; however, some may not know how to make a category template, and so we’ll go over that first. If you already know how to make a category template, you can skip to the bottom to see the plugin in action.

You will need to create these category templates on your server.

Step 1: Copy Your Category.php File

In the folder of your theme (wp-content/themes/theme-name) find the file titled category.php. Open it and copy the contents, so you can use that as a starting point for your new category template.

Step 2: Create a New Category Template File

Create a new category template file and name it something descriptive. It MUST start with the word “category” and then a hyphen (“category-“). Also, it MUST end with a “.php”  file extension.

In my example, I am going to put a banner in my template to make it different from the other categories, and so I’m going to name this category template “category-banner.php.”

(NOTE: Make sure you don’t name the file the same as a category on your site.)

Featured Plugin - WordPress Pop-Up Chat Plugin

No javascript required, no third part chat engine, just fully featured chat right in your own database on your own WP sites - couldn't be easier.
Find out more

Step 3: Paste Contents from Original Category File

Now, open the new file you’ve just created (category-banner.php) and paste the contents from your original category.php file into it.

Then, at the VERY TOP of that file, BEFORE EVERYTHING ELSE, put the following code with an appropriate name for your template. (In my case, I’m going to name this template “Banner.”)

<?php
/*
* Category Template: Banner
*/
?>

Your file should look something like this.

Step 4: Edit Your New Category Template

Now you can edit your new category template to make it as you like.

In this example, I am going to add a banner to this template. This means that the banner I put in will show up on every category page that gets assigned this template.

Here’s the banner I am adding to my template.

Featured Plugin - WordPress Facebook Plugin

Would you like to add Facebook comments, registration, 'Like' buttons and autoposting to your WP site? Well, The Ultimate Facebook plugin has got that all covered!
Find out more

The Category Template Plugin in Action

Now that we have the plugin activated, and we’ve made a new category template, we will see options to choose the category templates 1.) when we create a new category, and 2.) when we edit existing categories.

Creating a New Category

The option to choose a template for your category appears at the bottom of the left-hand side when you create a new category. (Posts > Categories)

Editing Existing Categories

The option to choose a template also appears at the bottom of the page when you are editing an existing category.

The Result

And here’s the result of my banner template test.

(NOTE: These templates style only your category pages – e.g. mysite.com/category/music. They do not style the individual posts in the categories.)


Featured Plugin - WordPress Newsletter Plugin

Now there's no need to pay for a third party service to sign up, manage and send beautiful email newsletters to your subscriber base - this plugin has got the lot.
Find out more

Photo: Letterpress Blog from BigStock

Comments (10)

  1. I may be doing something wrong, but I cant seem to get it to work. Maybe a change that has been made to WordPress but it seems just as easy as it does work with post?

  2. By any chance would you know how to do about the same thing with post? I want to have it so in the theme I am working on I can set up a few template for post and pick what one I want to use when I make the post.

Participate