1

I am using Zephyr theme The link to the blog page. I want to style each post differently based on the post category ex: social media, announcements ect.

I would like to style them using a cards layout with different colors when its a different category but that means messing with the php, html, css. Link to card style

What is the best way to go about this? Which files would i need to edit? i would need to make some type of loop right?

  1. What PHP files do I edit?
  2. What Functions do I need to know?
0

If your theme has body_class() in the body tag (normally in header.php) then the category name is added to the body tag as a class e.g.

<body class="my-category">

So in a css file you can do

.my-category #my-element {
 background:#FF0000;
}

To edit the html for the categories to make them card layouts then you would need to edit the category.php file (or create one if your theme is missing it).

Put the html for the cards in the_loop

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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