Title: Replace image attribute with a class instead? (image uploader)
Last modified: August 19, 2016

---

# Replace image attribute with a class instead? (image uploader)

 *  [devotee](https://wordpress.org/support/users/devotee/)
 * (@devotee)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/replace-image-attribute-with-a-class-instead-image-uploader/)
 * I would like to be able to apply a class to each image I put in my posts. I can
   do it manually of course, after the image code is in the editor, but this site
   is going to be used by people with little or no experience in web, so it would
   be better to just have an option to type in the class when you put the image 
   in the post.
 * Could you write a function that either replaces for example the link option with
   a class option? Or maybe even add another option to type in a classname?

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

 *  [jkovis](https://wordpress.org/support/users/jkovis/)
 * (@jkovis)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/replace-image-attribute-with-a-class-instead-image-uploader/#post-2062901)
 *     ```
       I would like to be able to apply a class to each image I put in my posts
       ```
   
 * – Are the default classes that WordPress provides not adequate enough? Are you
   trying to target CSS styles to post images?
 * – I took a quick look and couldn’t find anywhere to hook into the default image
   classes WordPress uses, though I guess you could filter the post content before
   it’s saved to the database.
 *     ```
       Or maybe even add another option to type in a classname?
       ```
   
 * – When using the visual editor if you [hover over an image already in the post editor](http://en.support.wordpress.com/images/image-settings/#within-posts)
   there is an image editor icon that appears. On the modal window that appears 
   after clicking the icon there is an “Advanced Editor” that lets you add additional
   class names.
 *  Thread Starter [devotee](https://wordpress.org/support/users/devotee/)
 * (@devotee)
 * [15 years, 1 month ago](https://wordpress.org/support/topic/replace-image-attribute-with-a-class-instead-image-uploader/#post-2063002)
 * I would like to apply different css-settings to different images, so I have the
   power to float them around and use different padding and margin if I like.
 * I did find a code witch adds the image dimensions as a class name, pretty nifty
   and does the trick for me, since I want to be able to style every image with 
   the same dimensions the same way anyway.
 * Thanks for telling me about that beeing able to add a class in the advanced editor,
   I´ve never even seen that! That is great, although in this case I think its just
   as cumbersome for my clients to do that as to add the class by just typing it
   in. Anyway, I solved my problem.
 * Thanks for helping

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

The topic ‘Replace image attribute with a class instead? (image uploader)’ is closed
to new replies.

## Tags

 * [append](https://wordpress.org/support/topic-tag/append/)
 * [class](https://wordpress.org/support/topic-tag/class/)
 * [editor](https://wordpress.org/support/topic-tag/editor/)
 * [image](https://wordpress.org/support/topic-tag/image/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [devotee](https://wordpress.org/support/users/devotee/)
 * Last activity: [15 years, 1 month ago](https://wordpress.org/support/topic/replace-image-attribute-with-a-class-instead-image-uploader/#post-2063002)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
