Wrap Post Image Inside Div Automatically

By default, WordPress sends images to the editor by applying necessary classes in the img tag e.g. alignnone size-medium wp-image-13. These built-in classes are very useful for applying any style to the post images.

But sometime, we need some extra in order to complete design requirement as in our case to wrap post images in a div automatically. Thanks to WordPress who has provided suitable hooks and filters at every point in order to fulfill maximum customization.

Let have a look at the following code snippet,

We hope that the above code snippet will be helpful for you in order to wrap images in a div. You may also be interested in our other codes about wp_query pagination, different single template category and remove #more tag.

email

Comments are closed.

Post Navigation