Use figure HTML tag when inserting images into post editor

If you use a theme that is coded using HTML5, then it’s a good idea to make sure, that when you insert an image in your post, in the front end, the image is displaying using the figure HTML tag, instead of the old div HTML tag.

The HTML syntax for the figure is:

Enable figure HTML tag in WordPress themes

If you are using a WordPress that doesn’t have the support for HTML 5 tags enabled you can simply use this code snippet, in your theme’s functions.php file:

In the above code, I did enable all the features like search forms, comment form, all the others. After implementing the php code above, when you will insert an image into your post content, the image in your front end will be wrap in the figure html tag. Also don’t forget to include the image caption, it’s not necessary, but it’s a good practice.

Reference link: add_theme_support()

Published by Eduard

A young and passionate man which loves to build and to customize WordPress Themes. His main passion is to work / improve / customize Divi WordPress Theme from Elegant Themes.

Leave a comment

Leave a Reply

Share This
%d bloggers like this: