Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make better responsive images #129

Open
jonathanstegall opened this issue Jul 12, 2020 · 1 comment
Open

Make better responsive images #129

jonathanstegall opened this issue Jul 12, 2020 · 1 comment

Comments

@jonathanstegall
Copy link
Member

Today I learned why WordPress often doesn't output srcset images from its default methods. See this answer

To show a srcset, there must be multiple image sizes of the same aspect ratio. When you set your thumbnail to hard crop without creating any other image sizes you are ensuring that there won't be a srcset.

You might find my answer here helpful.

Briefly, in your case, adding this line:

add_image_size ( 'double-size', 1270, 400, true );

... will make a srcset with both the cropped sizes when you upload a fresh image larger than 1270x400.

@jonathanstegall
Copy link
Member Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant