By default in WordPress, when you write content and insert images between content, you will get the caption option. Once you write the image caption, it will display to front end.
But that caption is auto build in the
div tag, and if you want to change it to something else, you will have to change every time the tag. So the question comes how we can use the different tag in that place automatically. For eg:
The answer is in this post, you just need to focus on this guide and follow the instruction step by step. Only with few lines of code, you can easily use figure and figcaption for captions.
Let’s not waste time and get to the point.
WordPress Figure Figcaption for Caption
Below we have embedded the code snippets that you need to put in your theme. Just copy the below code and paste it into your theme’s functions.php file.
After that, save then upload the image and type the caption. After that view the result in code view.
Tested on: WordPress 4.7 and still working.
Code to output image caption in figure and figcaption.
Hope this code works like a charm to you too. Don’t forget to give us the opinion about this post in the comment box.
Also, do share this guide on social media website, if it helped you.