I’m currently writing a plugin that displays some images – possibly with captions. So, I was wondering whether to use XHTML (<div>
s and <span>
s) or HTML 5 (<figure>
and <figurecaption>
) for output.
I image that the answer to this question depends somewhat on the theme being used. Is there a way to figure out which output format the user’s theme is using? Or what’s the best approach here? What’s WordPress doing to solve this issue?
WordPress will not help you here. In back-end use conservative XHTML 5:
<br />
, but not<figure>
(see WP coding standards).In front-end ⦠it is hard to determine the Doctype and the usage of polyfills, so stay with regular HTML as long as possible or load the necessary polyfills from your plugin.