Site logo

Archived topic

Elements - Hook

3 replies · Started by Nadine on January 4, 2023

Viewing posts 1–4 of 4

Hello, I want to add one css class to all posts, not pages. Is that possible with Elements / Hook? And how it works?

Hi there,

create a Hook Element.
Add the CSS styles inside style tags eg.

<style>
.element {
    color: #f00;
}
</style>

Set the the Hook to: wp_head
Set the Display Rules to: Posts -> All Posts

Hello David, thank you for your feedback. But that isn´t what I want to do. I only want to add one class (example class="test") for some articles and sides without style. Because css-style I want to write only on one places: in my style.css of child-theme

The Elements module can only Hook in HTML/Content.
It can't filter HTML to add the class. You would need to use the body_class filter hook.

Question - how will you determine which posts are to be given the particular class ?
For example: Posts with a specific Category Term.

This archived topic is closed to new replies.