• i want to add css class to my all images how can i do it? such that i can use that css class to custom css section. is there any hook available or any php snippet?

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • i want to add css class to my all images

    If you want to add one class to “ALL” your images as you say… why do you need to do this at all? Wouldn’t it be better to target the img tag directly?

    Moderator bcworkz

    (@bcworkz)

    You could use the ‘wp_insert_post_data’ filter to search through post content to find img tags and their related class attribute. If your desired class is not already there, it could be inserted. This filter fires just before a post is inserted into the DB.

    Since finding the class attribute involves first finding all img tags, George brings up a very good point. But the answer to your question is above all the same.

    Thread Starter parkinternet

    (@parkinternet)

    @gappiah i am not writing my posts on post section so that i can’t change the html and add inline css class to it, my image is on my media library and i want to place it into my elementor designing template but i need that image css to customise it, but how can i make the css class of that image? is there any plugin to do that or an any php code to directly insert random css class to each image.

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Image css’ is closed to new replies.