How to add a div around non-captioned images?
-
Hi, I’d like to change the way non-captioned images are specified in html when they’re aligncenter. Currently, it looks like:
<a><img class="aligncenter"/></a>
but I’d like it to be:
<div class="aligncenter"><a><img/></a></div>
I couldn’t figure out how or where to do this. There are filters for captioned images and the caption shortcode, and filters for the img itself, but how can I robustly hook in, remove the aligncenter from the img and put it into a div that contains the link as well?
As for why I want to do this, I really dislike how links around display:block margin auto centered images work, since it makes the entire width of the post where the image is a link, instead of it just being an image. If I could fix that in css that’d be great, but I couldn’t figure out how to do it without getting a div around the whole thing, hence the above question.
Thanks,
Chris
- The topic ‘How to add a div around non-captioned images?’ is closed to new replies.