So, if you want to make the Category whose ID number is 6 look different from what it is currently (and different from other Category pages), you would want to create a category-6.php file. If you want to make all Category pages look different from other archive pages (such as date and author archives), then you would want to create or modify the category.php file. If you want to make changes to the look of all archive pages, you can create or modify the archive.php file. And if you modify the index.php file, you will affect your entire blog.
How to Create a Template for Each Post Category in WordPress
WordPress makes it possible to pull in very specific types of content on your website through the use of the WP_Query class. If you include WP_Query before The Loop, WordPress lets you specify which category you want to pull information from. If you have a category called WordPress and want to display the last three posts from that category — on your front page, on your sidebar, or somewhere else on your site — you can use this template tag.
The code also contains the reference to the loop/loop-testi.php file. This is another file you need to copy. Copy loop-testi.php from wp-content/themes/CherryFramework/loop. And paste it to the wp-content/themes/theme#####/loop folder (if there is no loop folder there, you will need to create it). Rename the file to e.g. loop-new.php and open it for editing. Change the word “testi” everywhere in this file to “team” and save the changes. (You can do this using Control (Command) + F).
How to Add and Use Category Templates in WordPress
Today, I will demonstrate how to add and use category templates in WordPress. Before you begin this tutorial, you must take the time to create categories and add content to them. Adding category templates to WordPress requires you to edit files in the backend of your website. WordPress uses a hierarchy system to determine what template to load. By default, WordPress will use the theme’s templates, but by adding custom templates, WordPress will load and use those first.
How to create category template
WordPress CMS allows you to create different category templates and modify the category page content and layout. Be default the category page displays a list of published posts in a chronological order starting from the most recent posts. To create category templates you should perform several steps.
You can use the Page template (page.php) to define the layout and style for all the internal pages on your website, providing a standard and consistent style for your visitors. However, if your website also publishes a portfolio of work that you’ve done for clients, you probably want that page to have a different style from the rest of the pages because it presents images that represent your past work.