• I have a xxx web and mi images are like thumbals, you know.. a tube website.

    So, I need to add a class to all my images that I show in my web. I see other answers and they say that I should add a piece of code in my theme but I dont know what I should add for my specific case.

    • This topic was modified 5 years, 1 month ago by Jan Dembowski. Reason: Moved to Fixing WordPress, this is not a Developing with WordPress topic
Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator bcworkz

    (@bcworkz)

    Which editor are you using? For the classic editor, you can use the ‘image_send_to_editor’ filter to alter the HTML inserted in the editor. If you are using a page builder plugin like Elementor or the like, you should ask in their dedicated support forum.

    That leaves the block editor. If so, which block do you use? The usual image block?

    Thread Starter ayudasgonzalo

    (@ayudasgonzalo)

    Hello Bcworkz, and thanks to answer

    I bought a theme with wp-script. They give me a platform when I can add the descripción on my videos, the link of my video and the featured image of my video.

    It’s similar another big web sites like xvideos.com

    I have in my main interface of my website a lot of images of my videos . And I want to add a CLASS to ALL these images

    But when I see my images in my Media, I dont have a place where i can add the CLASS.

    So i am confused

    Moderator bcworkz

    (@bcworkz)

    By default, WP does not offer a image setting for custom classes. It’s expected such functionality would be added by themes and plugins if the devs felt it important enough. I’ve no idea what wp-script is supposed to do, which is why we direct commercial theme and plugin users to their respective support channels.

    Could you perhaps add the class to an outer container that’s part of your theme template and use that to target images?

    Or does the class need to be specific to only certain images within the outer container? If so, you could manually create an outer container for just specific images. For example, the block editor’s image block does have a custom class setting that is applied to the <figure> element that contains just that one image. That would meet you needs as well as anything I should think. Something similar should be possible in other editors if you don’t use the block editor.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add class to ALL my images’ is closed to new replies.