Skip to content

Make better responsive images #129

@jonathanstegall

Description

@jonathanstegall

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions