I need to add the "2x" to the url attribute srcset in wordpress 4.4.2. Maybe you can do so using a function in the functions.php file?

enter image description here


WordPress puts all resized versions of an image with the same aspect ratio into the srcset property. So if you need a "2x" image and one is not being generated already you could add an image size via add_image_size().

For the 2x image to be inserted in the correct circumstances you might need to tweak the sizes property via the wp_calculate_image_sizes filter.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.