• Resolved marcoapaulo

    (@marcoapaulo)


    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/3ZsmWeVt

    And what I do is this…
    https://pastebin.com/uvPFEmhn

    So, why is not working? Am I doing something wrong?

Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Different class for each category’ is closed to new replies.