Archived topic
Header Element - Load image with srcset for faster loading times
1 reply · Started by Miloš on December 14, 2021
Hi guys,
I'm trying to replace current featured image on blog post setup and I'm using GeneratePress Header Element.
What I've done is used this code to create a shortcode and added that shorcode in my element.
That's all working fine, issue I have now is that image doesn't have srcset on frontend. This means that full size image is loading on mobile phone and slowing down the page.
Is there a way to modify that code to add srcset or for me to do it another way?
Thanks!
Hi there,
why not use the GP Dynamic Image block in a Block Element ?
Block element:
https://docs.generatepress.com/article/block-element-overview/
Dynamic Block:
https://docs.generatepress.com/article/dynamic-blocks/