Different class for each category
-
Hi everyone,
I was looking for some kind of code that changed the class of a certain div or span depending on the category of the post.
I’ve searched the forum (and on google) and I think I’ve found what I’m looking for, but, for some reason, that I’m not aware of, the “thing” isn’t working.
What I’ve tried to use were these two…
https://pastebin.com/VSgsWpfZ and https://pastebin.com/bvdw5Krg
It’s almost the same thing, however the first one will return the default class for the posts instead of a special class for a specific category, which is better for me, since I don’t have to create a new category to the default posts.
What I want to do is this: I want to change the “mrc” (in the link below) to “category1class” or “category2class” depending on the category of the post.
https://pastebin.com/3ZsmWeVtAnd what I do is this…
https://pastebin.com/uvPFEmhnSo, why is not working? Am I doing something wrong?
- The topic ‘Different class for each category’ is closed to new replies.