RICG Responsive Images: plugin for implementing adaptive images to WordPress
The methods of implementation of img tag have not changed in WordPress for many years. Despite the fact that there are many options as to be picked up by the native WordPress functions, and change snippet img, such an approach may seem to beginners and some developers rather complicated. Take the same confusion here Picturefill and specifications srcset, and eventually you will realize that WordPress users there are not many options for use clear and well-functioning solutions for adaptive image in WordPress themes.
Why to use RICG Responsive Images plugin for WordPress themes
To solve this problem use the plugin called RICG Responsive Images. It "gives" users adaptive image immediately after its installation to WordPress themes without any additional effort. No parameters in the admin panel, configure the boot media or coding. The plugin comes with one dependent script for browsers that do not support native adaptive image. Deleting this file is optional and does not affect the performance of the plugin, if you are working with modern browsers.
Once the image is downloaded through the media interface, WordPress theme will automatically create three versions of images in different sizes. If the plugin is activated, add thumbnails and images in the content recording will return the standard layout for images WordPress, which will be added to the attribute srcset.
8Theme uses this attribute because it is the easiest way to add both developers and ordinary users. While the picture element provides the user with a more extensive set of options to WordPress themes, we decided that we attribute srcset more convenient as a turnkey solution. In addition, it will fit in if switching solutions for you goes beyond Art Direction purposes.
Unique features of RICG Responsive Images
The plugin is backwards compatible. This means that images which have been added to the plug-in installation, be adaptive if they were added to the record or a miniature column. This is because it uses the size of the images as previously defined in WordPress functions.php file and active theme. Image sizes are stored in an array everywhere srcset, which means that the image aspect ratio different from the initially loaded image will not be counted.
Currently, RICG Responsive Images adds the attribute sizes for completeness attribute srcset. The reason is that initially developers realized that couldn’t predict what might these dimensions, because they depend on how the user styled theme.
8Theme continues to work on this problem and encourage users to include their own attribute sizes to our premium WordPress themes - either manually or using the plugin in WordPress themes, such as wp-“lazy-sizes”. It should also say that the specification adaptive image was recently changed, and use the handle w must now be accompanied by an attribute sizes. The exception attribute sizes make markup technically incorrect, while the rollback will continue to be the standard size of 100vh.
How does the plugin work?
Most of the plugin’s functionality given to WordPress themes occurs when an image is dragged into a visual editor WordPress. Since all modified versions of the image (in different sizes) are in the process of downloading it, the only thing you can do - is to create an array that contains the URL-addresses available images in various sizes, as well as their sizes. This array is then filtered to remove it from the image sizes with aspect ratios that do not meet the full image.
Developers are going to add new features to RICG Responsive Images to handle the aspect ratio of 2x and 3x for sites with Retina-display. In addition, there will be the best support and documentation. Ultimately, we would like to see this plugin has become part of the core WordPress, remaining all the same minimalist, easy to use and deprived settings.