Setting up responsive image in WordPress

In current days maximum websites are getting converted to responsive – device friendly websites. If you have already converted your WordPress blog or website to responsive or will do, you may face some issues to transform your post images to responsive. Because, WordPress set image dimension (width & height) by default while you upload image from content editor or  from featured image box. There are simple ways to set your current WordPress images responsive without using any JavaScript or Plugin.

Step 1: Open functions.php file and add the filter code. It will restrict WordPress to add image dimension (width & height) while you upload next images via content editor or featured image box.

This code will not remove image dimension from the existing uploaded images. 

Step 2: Add the  CSS in your CSS file (style.css). This CSS will make the current all images to responsive. It does not matter if the images have hard coded dimension (width & height) or not.

Replace these class names ‘entry-content’, ‘comment-content’ with your absolute class names.

You may also like

Leave a Reply

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