In WordPress, if you would like to make your category archives different from each other (for example, giving them different styles or including different types of information on each), then it’s pretty easily done.

You will only need to make a new category template file for the categories you would like to change.

How to Make a New Category Template

Create a New File

You will need to go into your theme’s folder on your server to make your new category template.

Go to wp-content > themes > (your current theme). You should see a file there named category.php.

(Note: Some themes do not have a file named category.php. If that’s your case, look for a file named archive.php.)

To make a new category template, create a new file and name it “category-(name).php”  where (name) is the name of your category.

For example, say you want to make a category template for your “Food” category. Name the new file:

category-food.php

(Note: You are really naming the file according to your category “slug.” Unless you changed the slug to something different when you set up your categories, it should be named exactly the same as your category. If your category has more than one word, you will have hyphens between the words – e.g. Breakfast Food = breakfast-food, and so your category template would be named category-breakfast-food.php.)

 


Copy Your Original Category File

Probably the easiest way to create a new category template is to start with the same information that’s in your original category file. So open up your original category.php file. (In many systems you will need to click “Edit” to open it). Copy the original file and then open your newly created file (e.g. category-food.php) and paste everything into that new file.

You can then change the new file to suit your purposes for your Food category. You can give it new styling through your stylesheet, you can include or delete functions, etc.

An Example

For a quick example, I will add a line of text to my new category-food.php file that I created.

After saving it, this line of text should appear only on my Food Category archive page. And taking a look at it, it does.

New Category Template Pages

You can change your new templates to look however you like – giving them completely different styles or making them “behave “ in a completely unique way. You’re only limited by your imagination.

More articles about WordPress Categories:

Tags: