Accueil » Coding » Divi » Customize easily your “Category” page

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 and a 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.

Processing ...
USD

 

Information : Véritablement conquis par ce thème, je me suis inscrit sur le site de ElegantThemes en tant qu'affilié, ce qui signifie que si vous cliquez sur le lien ci-dessous et achetez le thème, je recevrai une commission :).

Information: Truly conquered by this theme, I registered on the site of ElegantThemes as an affiliate, which means that if you click on the link below and buy the theme I will receive a commission :).

 

Après avoir visité les coulisses, découvrez le site :) !

19 Comments

  1. Bettie

    This was a beautiful solution to redesign the blog pages! Incredible work – thank you. I’d love to see the same solution to apply to the individual Project pages too.

    Reply
    • Pierre

      Hi Bettie :).

      Thanks. There’s probably a solution for that, but sadly I have no time actually to manage it ;)…

      Have a great day.

      Pierre.

      Reply
  2. Karmen K

    Thanks so much! This worked perfectly.

    Reply
    • Pierre

      Hi Karmen :).

      Happy you like it :)!!

      Have a great day :D.

      Pierre.

      Reply
  3. David Hoch

    This is super helpful, however, I would like the posts to descend horizontally across the screen like the blog post module rather than vertically. Is this possible?

    Reply
    • Pierre

      Hi David :).

      I’m sorry but I really don’t understand what you mean :)…
      If you mean that you want to display posts like you do on your portfolio, you just have to set the layout to “Fullwidth” on the tab “Design” of your blog module on your category template :).

      Have a great day.

      Pierre.

      Reply
  4. Alex

    Hi again. 😀

    I used to solve my problems when i write for a help. 😀
    Maybe i am a little bit tired and i am paste wrongly the case.

    case ‘hu’:
    $my_cat = ‘category’;
    break;

    With this is working for Hungarian Language.

    Reply
    • Pierre

      Hi Alex :).

      Happy you make it work :)!

      Have a great day!

      Pierre.

      Reply
  5. Alex

    Hi!
    I am really appriciate your help. I am using the wordpress with hungarian language. I put the category.php to my child theme but nothing happened. If i switch the language to english it’s working fine.

    I add:

    case ‘hu_HU’:
    $my_cat = ‘category’;
    break;

    to the category.php but it doesnt help.

    Do you have any solution?

    Thanks for your helping.

    Reply
  6. Martin

    Hi,

    Tnx! works like a charm 🙂

    Is there a possibility to get this also working for the divi search results page?

    Best regards,
    Martin

    Reply
    • Pierre

      Hi Martin :).

      Happy you like it.

      For that kind of advanced functionality you should have a look at elegantmarketplace Sean Barton have created a plugin that do that job ;).

      All the best.

      Pierre.

      Reply
  7. Vi Mu

    Hi Pierre and thanks a lot for your solution but it doesn’t works in my case. I use the Divi blog extras plugin to set a different appearence to my blog entries and when I wanna set this appearence to the categories sections your code doesn’t works, if I try with the normal Blog module it works. Can you help me, please?

    Reply
    • Pierre

      Hi Vi mu :).

      Sorry but as I don’t know that plugin I really can’t help you with it and I’m afraid to not being able to adapt the script to every existing plugin ;)…
      I hope you’ll find a solution by yourself and you’ll come back here soon to share it with us :).

      Have a great day.

      Pierre.

      Reply
      • Vi Mu

        Hi Pierre and thanks for your reply,

        Definitely I can’t use Divi blog extras plugin for my purpose 🙁 Now I use your solution to show the same in every blog category but I wanna do the same with all the tags, is it possible with your solution?

        Thanks a lot!

        Reply
        • Pierre

          Hi Vi mu :).

          No. Sorry for that kind of functionnalities you should have a look on the Sean Barton plugins on Elegantmarketplace ;).
          I’m sure you’ll find what you need :).

          All the best.

          Pierre.

          Reply
          • Vi Mu

            Ok Pierre, I’ll contact with Sean Barton to try to solve this problem. Thanks a lot!

          • Pierre

            You’re welcome Vi Mu :).

            All the best.

            Pierre.

  8. Paul

    Hi!
    Thanks a lot for this. It worked fine. But it doesn´t show any blogentries of the categories i´ve chosen. It only appears a “404 – Site not found” in the part, where I´ve inserted the “Blog module”. I´ve set the number of posts on 10 (Divi options is 6).
    Can you help me?

    Thanks!!

    Reply
    • Pierre

      Hi Paul :).

      Sorry but without any URL, I can’t see the problem and can’t help you with it ;)…

      Have a great day.

      Pierre.

      Reply

Submit a Comment

Your email address will not be published. Required fields are marked *

Accueil » Coding » Divi » Customize easily your “Category” page