Hi @fidoboy.
I’m sorry but there is no filter to change the image output.
and how can I manage two or more sizes to display images on retina display (2x)?
Currently I can not provide a solution for this request. The srcset is an indivdual setting based on the activated theme and the provided image sizes.
Recent Posts Widget With Thumbnails gets the featured image by using get_the_post_thumbnail();
.There’s no direct way to add code for image urls in SRC SET. I have to create a srcset based on the available image sizes. And they can and will be different with each theme. Thats why Recent Posts Widget With Thumbnails does not support srcset.
I’ll think about whether I can provide an option or at least a filter to adjust these values.
I understand. And that’s a problem for the theme to solve, and not for widgets or display modules.
However you can provide with filter hooks and document it into the plugin faqs or the right place. It could be also solved with templates, if the plugin provides anyone that could be copied into the child theme folder.
Kind regards,
Hello @fidoboy.
I had a deeper look into your request and have to write, I can not provide a solution. As I wrote bevore srcset is part of the theme and WordPress.
As I wrote, Recent Posts Widget With Thumbnails is using get_the_post_thumbnail();
. The description of this function is
When a theme adds ‘post-thumbnail’ support, a special ‘post-thumbnail’ image size is registered, which differs from the ‘thumbnail’ image size managed via the Settings > Media screen.
The logic of this function is, that it can not provide a srcset because it provides just the ‘thumbnail’ image size. I also discussed this with the WordPress core team and received the same statement. A post thumbnail can have only one size. Otherwise, WordPress should have a built-in option to select a source set for the different sizes. And that’s not planned.
I’m sorry I can’t give another answer.
If you still need this feature, feel free to add it yourself. You can send us your updated code so that I can review it and integrate it into the regular version.