0

Is there a filter or hook that I can use for uploaded media?

I need to use it for custom CSS properties based on the media's description. It will be like:

<img src="image_url" style="width:  60%;" />

or

<img src="image_url" style="width:  80%;" />

Media description screenshot:

Edit Media screenshot

7
  • Have you checked code of plugins that do similar things, e.h. shadow-/lightbox plugins? Commented Jan 19, 2012 at 19:48
  • 1
    Are these images post images, or something else? Are you wanting to define the inline CSS manually, or automatically? Commented Jan 19, 2012 at 21:41
  • Have you checked code of plugins that do similar things, e.h. shadow-/lightbox plugins? – Raphael yesterday — No, I'm not sure they are doing the same thing. Commented Jan 21, 2012 at 13:33
  • Are these images post images, or something else? — Yes, these images post images. Commented Jan 21, 2012 at 13:39
  • 2
    What's your endgoal - your real target? You're so far only talking about what you want to achieve and so far it's off topic. Why don't you edit your post and tell us your situation and what you need. Commented Oct 23, 2012 at 0:10

2 Answers 2

1

After inserting the image, click it again and click the small edit window. You can then add inline CSS using the Advanced Settings already built into WordPress.

enter image description here

0

Why wouldn't you just use jQuery?

$(selector).css('width','60%')
2
  • I don't think so. Width is different for each image. For example Media Description is 80% so html must be <img src="image_url" style="width: 80%;" /> Commented Jan 22, 2012 at 18:43
  • the way i will do such kind of issue is that i will get description width and set the image width from description width using javascript. Why cant u try that? Commented Dec 25, 2013 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.