1

How can I add a css class based on categroy id in archive pages body in wordpress?

I want to style each category page different

3
  • Hi Naderi, can you share your code for the archive pages with us? And tell us which element you want a class added to? Most likely it's very easy.
    – ralphjsmit
    Commented Jul 7, 2020 at 11:42
  • 2
    The body already gets a unique class for each category. Commented Jul 7, 2020 at 14:39
  • here is my category page : bestwiki.palette-webdesign.ir/category/cinema and there is no unique class for this
    – Naderi
    Commented Jul 7, 2020 at 18:51

1 Answer 1

0

the link you gave has category class "category-26", so therefore to add custom styling to this specific page you just have to define class .category-26 before any of your custom style, example of adding custom css to specific your category page :

.category-26 article {
    background: #9999;
}

You can find specific category key with inspect element in <body> tag , in your case it was : <body class="rtl archive category category-cinema category-26 theme-aryan woocommerce-js elementor-default expansion-alids-init">

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.