Missing srcset attribute inside | WordPress.org

Plugin Author
Ajay

(@ajay)

Is this happening for all the images? I run the image generating HTML through the inbuilt WordPress filters that automatically add the srcset similar to other ones.

Can you show me please point me to where I can see the output on your site?

See code: https://github.com/WebberZone/contextual-related-posts/blob/3.5.4/includes/frontend/class-media-handler.php#L302C27-L302C63

It won’t work if there is no attachment ID, i.e. it’s not in the media library as it won’t know what images are available (at least that’s how I read it).

yes, it’s happening for all the images, they are the normal featured images of the posts, you can see it happening everywhere:
https://recensioni-migliori.com/materassi/classifiche/confronto-2022/

ie:

<picture>
<source sizes="(max-width: 300px) 100vw, 300px"
type="image/webp"
data-srcset="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp 300w, https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600.png.webp 600w">
<img style="max-width:300px;max-height:113px;"
src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAASwAAABxAQAAAABHYaNFAAAAAnRSTlMAAHaTzTgAAAAbSURBVFjD7cGBAAAAAMOg+VNf4AhVAQAAAHAMETcAAYNa3Q8AAAAASUVORK5CYII="
class="crp_featured crp_thumb medium lazyload"
alt="Materassi e Doghe Pale Special"
title="Materassi e Doghe Pale Special"
data-eio="p"
data-src="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png"
decoding="async"
data-srcset="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png 300w, https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600.png 600w"
data-sizes="auto"
width="300"
height="113"
data-eio-rwidth="300"
data-eio-rheight="113"/>
</picture>

Plugin Author
Ajay

(@ajay)

@stefanoste

I just checked your site URL and don’t see a picture>source. But a figure>img which is how I generate the code within CRP. See the code I have and the browser screenshot.

<figure>
<img
style="max-width: 300px; max-height: 113px;"
src="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp"
class="crp_featured crp_thumb medium lazyautosizes lazyloaded"
alt="Materassi e Doghe Pale Special"
title="Materassi e Doghe Pale Special"
data-src="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp"
decoding="async"
data-srcset="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp 300w, https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600.png.webp 600w"
data-sizes="auto"
width="300"
height="113"
data-eio-rwidth="300"
data-eio-rheight="113"
sizes="300px"
srcset="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp 300w, https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600.png.webp 600w"
/>
<noscript>
<img
style="max-width: 300px; max-height: 113px;"
src="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp"
class="crp_featured crp_thumb medium"
alt="Materassi e Doghe Pale Special"
title="Materassi e Doghe Pale Special"
srcset="https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600-300x113.png.webp 300w, https://recensioni-migliori.com/wp-content/uploads/2021/05/pale-600.png.webp 600w"
sizes="(max-width: 300px) 100vw, 300px"
data-eio="l"
/>
</noscript>
</figure>

See the screenshot: https://ibb.co/ySCkdms

Wondering if this is being “converted” or rendered differently in another browser? I’m on Firefox for Mac. But also checked it in Brave which is built on Chromium.

@ajay thank you for the check, there must surely be another cause

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer