I’m creating a blog with wordpress, I’m using the DIVI theme and I need to change the appearance of the category pages of the blog…
what’s the easiest way to do that?
I understood I should look for category.php in the editor and create a new php file, but I couldn’t find anything…
2
Answers
You will find category.php in your theme folder and customize according to your requirement.
If category.php file is not exist in your theme then you can create a new file with category.php name and do customization it will automatically uses this file when you will display category posts.
You need to create category template like below :
First off, if there actually exists a file named
category.php
in your theme folder, it would be unwise to follow @Lalji Nakum’s advice regarding editing the file directly. That would mean that you potentially lose all your changes in a future theme update. Instead you should either create a template file containing the ID or the slug of the category you would like to change. If you are to change the way all categories are displayed, you should instead create a child theme – holding your own version of category.php.If there is no category.php in your theme folder, that means the theme controls this view in either archive.php or index.php. There’s a strict hierarchy that WordPress follows, looking for a way to display categories. You would then create the file and make whatever changes to how they are to be displayed. A problem here might be that you would have to make it from scratch. An alternative would be to fall back to the child theme solution, track down where in fact your theme is controlling the view (in any of the two previously mentioned files), duplicate the file into your new child theme and do your changes here.
It’s now established that you have no category.php in your theme today. You then have to choices, primarily. This is the best one:
Create the contents of the file from scratch. A good place to start would here:
Make all your wanted changes to the template.
Creating a child theme is fairly simple, and is explained here: https://codex.wordpress.org/Child_Themes
Also it sounds like you are looking to create the file from the editor. That’s not built in functionality, but could be managed resorting to creative solutions like this: http://ronangelo.com/create-new-theme-file-in-wp-admin-without-ftp/ . The better alternative would be to use ftp/ssh, though.
Read more about how category templates, including the mentioned hierarchy, work here: https://codex.wordpress.org/Category_Templates