Add CSS class to every image

I want to add a CSS class “myimg” to every image both inside and outside of a post. What is the best way to approach this?

Related posts

2 comments

  1. function add_image_class($class){
        $class .= ' additional-class';
        return $class;
    }
    add_filter('get_image_tag_class','add_image_class');
    
  2. Try to use this j query function like this in header file

    $(document).ready(function() {
     $("img").addClass("myimg")
    });
    

Comments are closed.