Skip to main content
added 46 characters in body
Source Link
bart
  • 225
  • 1
  • 2
  • 9

I'm inserting an image in my theme as follows:

the_post_thumbnail('large');

Which results in the following HTML:

<img class="wp-post-image" width="660" height="440" sizes="(max-width: 660px) 100vw, 660px" srcset="/uploads/IMG-1024x683.jpg 1024w, /uploads/IMG-300x200.jpg 300w, /uploads/IMG-768x512.jpg 768w, /uploads/IMG-254x169.jpg 254w, /uploads/IMG-578x385.jpg 578w, /uploads/IMG-665x443.jpg 665w, /uploads/IMG-1600x1067.jpg 1600w" src="/uploads/IMG-1024x683.jpg">

Notice width="660" height="440" and sizes="(max-width: 660px) 100vw, 660px" which doesn't correlate with the size defined for large in Media Settings > Image sizes which is supposed to be 1024 x 1024.

What am I doing wrong?

I'm inserting an image in my theme as follows:

the_post_thumbnail('large');

Which results in the following HTML:

<img class="wp-post-image" width="660" height="440" sizes="(max-width: 660px) 100vw, 660px" srcset="/uploads/IMG-1024x683.jpg 1024w, /uploads/IMG-300x200.jpg 300w, /uploads/IMG-768x512.jpg 768w, /uploads/IMG-254x169.jpg 254w, /uploads/IMG-578x385.jpg 578w, /uploads/IMG-665x443.jpg 665w, /uploads/IMG-1600x1067.jpg 1600w" src="/uploads/IMG-1024x683.jpg">

Notice width="660" height="440" which doesn't correlate with the size defined for large in Media Settings > Image sizes which is supposed to be 1024 x 1024.

What am I doing wrong?

I'm inserting an image in my theme as follows:

the_post_thumbnail('large');

Which results in the following HTML:

<img class="wp-post-image" width="660" height="440" sizes="(max-width: 660px) 100vw, 660px" srcset="/uploads/IMG-1024x683.jpg 1024w, /uploads/IMG-300x200.jpg 300w, /uploads/IMG-768x512.jpg 768w, /uploads/IMG-254x169.jpg 254w, /uploads/IMG-578x385.jpg 578w, /uploads/IMG-665x443.jpg 665w, /uploads/IMG-1600x1067.jpg 1600w" src="/uploads/IMG-1024x683.jpg">

Notice width="660" height="440" and sizes="(max-width: 660px) 100vw, 660px" which doesn't correlate with the size defined for large in Media Settings > Image sizes which is supposed to be 1024 x 1024.

What am I doing wrong?

Source Link
bart
  • 225
  • 1
  • 2
  • 9

the_post_thumbnail ignores size parameter

I'm inserting an image in my theme as follows:

the_post_thumbnail('large');

Which results in the following HTML:

<img class="wp-post-image" width="660" height="440" sizes="(max-width: 660px) 100vw, 660px" srcset="/uploads/IMG-1024x683.jpg 1024w, /uploads/IMG-300x200.jpg 300w, /uploads/IMG-768x512.jpg 768w, /uploads/IMG-254x169.jpg 254w, /uploads/IMG-578x385.jpg 578w, /uploads/IMG-665x443.jpg 665w, /uploads/IMG-1600x1067.jpg 1600w" src="/uploads/IMG-1024x683.jpg">

Notice width="660" height="440" which doesn't correlate with the size defined for large in Media Settings > Image sizes which is supposed to be 1024 x 1024.

What am I doing wrong?