WordPress: Replace DIVs with HTML5’s FIGURE and FIGCAPTION

I have another annoyance with WordPress and its lack of figure and figcaption when inserting media that has, you know, a caption…

So, naturally I checked the Internet, trying to find something that someone else did so I wouldn’t have to do it. And what I came across was this:
http://justintadlock.com/archives/2011/07/01/captions-in-wordpress

There were a couple things that I didn’t like, for instance, the lack of figure and figcaption… So I made a few changes, and now have this:
https://github.com/aarontgrogg/wp-plugin-figure-figcaption

I also recommend adding this to your CSS file, in addition to the standard HTML5 Shiv-type stuff:
.wp-caption.aligncenter img {
margin: 0 auto;
}
.wp-caption.aligncenter figcaption {
text-align: center;
}

Happy figuring & captioning,
Atg

3 Responses to WordPress: Replace DIVs with HTML5’s FIGURE and FIGCAPTION

  1. Nipon says:

    It doesn’t work for images that don’t have a caption. I’d like to see tags around images without caption too.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Your post must include a link to this post.

How does this work?
Write a response on your own website and include a link to this post. Then submit your response’s URL here. Your response may appear here after moderation. To update or remove it, edit or delete your original post and submit the same URL again. Learn more about Webmentions.