Dynamic srcset for images in WordPress Module

The Post Featured Image has this feature, would be good to have something like this for any image.

1 Like

It isn’t a 100% workaround, but you can always use the Block Inner Content smart action, then add the image using the WP block editor. That will give you a srcset image. Or, if users/editors don’t need to modify the image in a block, you can use the new picture element in Pinegrow.

Note: you can only have one inner content smart action per block, so this won’t always be an option. I’m pretty sure that’s a limitation of the Block Editor, but team Pinegrow can correct me if I’m wrong there.

1 Like

Yes, that’s a WP thing. It would be very useful to have multiple inner content areas. I think this limit comes from React.

Looking at WP code, it appears that srcsets are added when the page is being displayed, not when the block / posts are saved. That happens if wp-image-[id] class is set on the image.

I implemented this for image Block attributes and srcsets are now added.

This will be soon out in PG Live distribution.

2 Likes