In WordPress, if you need to make your class archives totally different from one another (for instance, giving them totally different types or together with several types of data on every), then it’s fairly simply achieved.
You’ll solely have to make a brand new class template file for the classes you wish to change.
How you can Make a New Class Template
Create a New File
You’ll need to enter your theme’s folder in your server to make your new class template.
Go to wp-content > themes > (your present theme). You need to see a file there named class.php.
(Notice: Some themes don’t have a file named class.php. If that’s your case, search for a file named archive.php.)
To make a brand new class template, create a brand new file and identify it “category-(identify).php” the place (identify) is the identify of your class.
For instance, say you wish to make a class template on your “Meals” class. Title the brand new file:
category-food.php
(Notice: You might be actually naming the file in line with your class “slug.” Except you modified the slug to one thing totally different once you arrange your classes, it must be named precisely the identical as your class. In case your class has a couple of phrase, you’ll have hyphens between the phrases – e.g. Breakfast Meals = breakfast-food, and so your class template can be named category-breakfast-food.php.)
Copy Your Unique Class File
In all probability the simplest method to create a brand new class template is to start out with the identical data that’s in your unique class file. So open up your unique class.php file. (In lots of techniques you’ll need to click on “Edit” to open it). Copy the unique file after which open your newly created file (e.g. category-food.php) and paste the whole lot into that new file.
You possibly can then change the brand new file to fit your functions on your Meals class. You may give it new styling via your stylesheet, you’ll be able to embrace or delete features, and so forth.
An Instance
For a fast instance, I’ll add a line of textual content to my new category-food.php file that I created.
After saving it, this line of textual content ought to seem solely on my Meals Class archive web page. And looking at it, it does.
New Class Template Pages
You possibly can change your new templates to look nevertheless you want – giving them utterly totally different types or making them “behave “ in a unique means. You’re solely restricted by your creativeness.
Extra articles about WordPress Classes:
WordPress Tip: How you can Present Posts from Simply One Class
Subscribe to MarketingSolution.
Receive web development discounts & web design tutorials.
Now! Lets GROW Together!