no “sizes” attribute for images?
-
Hi Hector
I use my theme thumbnail for the widget rather than the built-in thumbail functionality (via the
wpp_parse_custom_content_tags
filter). I just use a simpleget_the_post_thumbnail($post_id, 'my-size')
to generate the html output. This outputs all the normal attributes that it outputs elsewhere (e.g.title
andsrcset
etc) however thesizes
attribute doesn’t appear. Even if I try to force one by usingget_the_post_thumbnail($post_id, 'my-size', array('sizes' => '40px'))
it doesn’t appear in the eventual output. I can add any other attribute that I want (e.g.get_the_post_thumbnail($post_id, 'my-sizes', array('data-sizes' => '40px'))
works as expected and I get adata-sizes
attribute output to the page.So it looks like something is somehow sanitizing or otherwise removing the
sizes
attribute. This attribute does work on all the other image displays on my site so it isn’t a site-wide problem, it only doesn’t work within WPP as far as I can tell. Do you have any ideas what could be causing this, or any suggestions for how I might fix it? I did try using thewpp_post
filter instead but the problem still remains with that too.Cheers
- The topic ‘no “sizes” attribute for images?’ is closed to new replies.