The Divi theme created by ElegantThemes is close to the no-fault; Nevertheless it misses one thing that his little brother inherited and that is the easy customization of the category page.
So with the Extra theme you can easily change the rendering and content of each page of our categories but there is no way to do it easily with Divi.
Starting from the code of Fabrice Esquirol which I thank in passing;), I wanted to relax the method allowing this personalization. For this I created for you a file “category.php“. I have prepared it for the most commonly used languages. That is to say :
- English: the category that you wish to customize will have to be named “Category followed by the name of your category”,
- French: the category that you wish to customize will have to be named “Catégorie followed by the name of your category”,
- Spanish: the category that you wish to customize will have to be named “Categoria followed by the name of your category”,
- Italian: the category that you wish to customize will have to be named “Categoria followed by the name of your category”,
- German: the category that you wish to customize will have to be named “Kategorie followed by the name of your category”.
Now the procedure to be able to use it :)!
- Place the file “category.php” in the folder of your child theme of Divi :).
- Create a template with the name of an existing category in your site that you wish to customize with the following syntax. For the “Example” category, name your model “Category Example“.
As WordPress will replace all special / accented characters and spaces, the slug of my model will become “category-example” (and it is this type of name that my file “category.php” will look for to know if a category must be customized 😉 …).
- Customize your model as you like by adding all the elements you want. Don’t forget to add a blog module with
the current category selected anda number of posts equal to or greater than the value entered in the “Number of Posts displayed on Category page” section of the Divi options, otherwise nothing will be shown for your category or you’ll get problem with the pagination 😀 !
- I’ve added a new possibility. Define a template by default for all the categories 😀 ! For that, like for the categories that you wish to customize, add all the elements that you wish to see (don’t forget the “blog” module) and save your layout with the name “Category” (“Catégorie” in French, “Categoria” in Italian and Spanich, “Kategorie” in Deutch).
- Thanks to Surya thanks to whom I discovered that the English used a specific version of WordPress (with encoding “en_GB”) and that allowed me to add this “peculiarity” to my file
- Thanks to Gary Armstrong who allowed me to optimize the international aspect of the page category.php;)!
- Appreciate the new rendering of your category 😀 !!
Click here to download the file “category.php” to place in the folder of your child theme of Divi.