Overwrite Wp's default 'srcset' and 'size' values of a specific image
-
Thank you for your interest in this post.
In version 4.4 native responsive image support has been added. Overall, the resized images on different displays fit well, with some exceptions…
Therefore I would like to overwrite the default ‘srcset’ values generated by WP and replace them with my customized values for a specific image (not necessarily change the global settings).
E.g.:<img width="350" height="130" src="https://localhost/test/wp-content/uploads/2016/08/test-logo-130x350.png" class="custom-logo" alt="test-logo-130x350" itemprop="logo" srcset="https://localhost/test/wp-content/uploads/2016/08/test-logo-130x350.png 350w, https://localhost/test/wp-content/uploads/2016/08/test-logo-130x350-300x111.png 300w" sizes="(max-width: 350px) 85vw, 350px">
Should become (link changed on line 4):
<img width="350" height="130" src="https://localhost/test/wp-content/uploads/2016/08/test-logo-130x350.png" class="custom-logo" alt="test-logo-130x350" itemprop="logo" srcset="https://localhost/test/wp-content/uploads/2016/08/test-logo-130x350.png 350w, https://localhost/test/wp-content/uploads/2016/08/logo-small.png 300w" sizes="(max-width: 350px) 85vw, 350px">'
Would be grateful for any instruction!
Regards,
Janosh
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Overwrite Wp's default 'srcset' and 'size' values of a specific image’ is closed to new replies.