Reputation: 2287
I can apply styles to different posts based on their "#tags" using {TagsAsClasses}
:
<div class="post {TagsAsClasses}">
div.tag {
/* whatever styling */
}
This works fine, however if I already have a class in the theme with styling and then apply the tag with the same name as that class, the theme breaks. For example, the theme uses the class ".cover", and a post has the tag "#cover".
This would usually be fine because I would just change the class name, however I need to make sure that this same code works for about 65 students so I need to be able to define specific tags that the styling will affect.
Upvotes: 0
Views: 114
Reputation: 7122
To ensure there are no conflicts between your theme's styling classes and any post's tag classes, you could add a prefix to all of your tag classes.
For example, instead of using {TagsAsClasses}
, you have:
<div class="post {block:Tags}tag-{PlaintextTag} {/block:Tags}">
The "Plaintext" prefix makes the theme variable {Tag}
safe to include in HTML attributes.
Upvotes: 2