How to Create Category Templates in WordPress

Do you want to create unique category page layouts in WordPress?

With WordPress websites, it’s common to use different templates for categories, tags, custom post types, and taxonomies.

In this article, we’ll show you how to create category templates in WordPress.

Creating category templates in WordPress

By creating templates for categories, you can add specific features on category pages.

For example, you can allow users to subscribe to categories, add category images, show category descriptions and choose a different layout for each category.

Why Create Category Templates in WordPress

WordPress generates individual pages for all your categories. You can view them by visiting a URL like:

Most popular WordPress themes come with built-in templates to beautifully showcase category pages. These templates highlight the category title and show the category description below it.

Category page example

However, some themes may not handle this so nicely, or you may want to customize your category pages. This is where you need to create category templates in WordPress.

Let’s take a look at how to create category templates in WordPress.

WordPress Template Hierarchy for Category Pages

WordPress has a powerful templating system that lets you create different templates for different sections of your website.

When displaying any page, WordPress looks for a template in a pre-defined hierarchical order.

To display a category page, it looks for templates in this order: category-slug.php → category-id.php → category.php → archive.php → index.php

First, WordPress will look for a template specific for that particular category using the category slug. For example, category-design.php template will be used to display the ‘Design’ category.

If it does not find a category-slug template, then WordPress will look for a template with category id, for example, category-6.php. After that, it will look for the generic category template which is usually category.php.

If there is no generic category template present, then WordPress will look for a generic archive template, such as archive.php. Lastly, it will use index.php template to display the category.

Here’s our guide to WordPress template hierarchies.

Creating a Category Template for Your Theme in WordPress

Let’s first take a look at a typical category.php template.




Sorry, no posts matched your criteria.

Now let’s assume that you have a category called “Design” with the category-slug “design” and you want to display this category differently than others.

To do that, you need to create a template for that particular category. Go to Appearance » Theme Editor. From the list of theme files on your right, click on category.php, if you do not have a category.php file there, then look for archive.php.

Theme category file editor

If you can’t find either of these templates, there is a good chance that you are using a WordPress Theme Framework and this tutorial may not be useful for you. We suggest that you refer to the specific framework you are using.

If you find the files above, then copy all the contents of category.php and paste them in a text editor like Notepad. Save this file as category-design.php.

Connect to your WordPress hosting using an FTP client and then go to /wp-content/themes/your-current-theme/ and upload your category-design.php file to your theme directory.

Now, any changes you make to this template will only appear in this particular category’s archive page.

Using this technique, you can create templates for as many categories as you want. Just use category-{category-slug}.php as the file name. You can find category slugs by visiting the categories section in the WordPress admin area.

Here is an example of a category-slug.php template. Notice that we have used the same template as category.php with few changes.

Since we already know the category it will be used for, we can add title, description, or any other details manually. Also notice that we have used instead of .

Check out why we think using post summary or excerpt instead of full post is a good idea.


Design Articles

Articles and tutorials about design and the web.

Sorry, no posts matched your criteria.

If you do not want to use the category-slug template, then you can use the category-id template to create a template for a specific category ID. Here’s how to find a category ID in WordPress.

Using Conditional Tags for a Category

When creating templates for your theme, you need to determine if you really need a separate template to do what you want to do.

In some cases, the changes you want to make are not too complicated and can be achieved using conditional tags inside a generic template, like category.php or even archive.php.

WordPress comes with support for many conditional tags that theme authors can use in their templates.

One such conditional tag is is_category(). Using this conditional tag, you can change your templates to display different output if the condition is matched.

For example, let’s suppose you have a category for featured posts called “Featured”.

Now you want to show some extra information on the category archive page for this particular category. To do that, add this code in category.php file right after .

Featured Articles:

Category Archive:

Create a Category Template Using Beaver Themer

Beaver Themer allows you to create layouts for your theme. You can select the individual categories where you want to use the template and then edit it using a drag and drop tool.

First, go to Beaver Builder » Themer Layouts » Add New page.

Add new category template

You’ll need to give it a title and then select your category under ‘Location’ option.

Edit Beaver Themer layout

From there, you’ll be able to use Beaver Builder’s drag and drop editor to customize your category layout page to your liking.

Using Beaver Builder to design your category template

Once you are done, click on the Done button and then select publish to apply your category template.

You can now visit your website to see the category template in action.

A category template made with Beaver Builder

We hope this article helped you learn how to create category templates in WordPress. You may also want to see our comparison of best drag & drop WordPress page builders for creating custom layouts, and our guide on how to create a membership site, so you can restrict content based on categories.

If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.