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

the_post_thumbnail() not returning srcset attributes. #232

Closed
joemcgill opened this issue Nov 11, 2015 · 2 comments
Closed

the_post_thumbnail() not returning srcset attributes. #232

joemcgill opened this issue Nov 11, 2015 · 2 comments
Assignees
Labels
Milestone

Comments

@joemcgill
Copy link
Member

See this support thread at WP.org.

The gist of the issue is that the_post_thumbnail() passes the named size post-thumbnail to get_the_post_thumbnail() which, in turn, uses wp_get_attachment_image() to build the markup. In core, we are converting the returned size to a size array before calling wp_calculate_image_srcset() but in the plugin we are filtering the wp_get_attachment_image_attributes and are passing the size name to wp_get_attachment_image_srcset().

Perhaps we should transform the named size into an array an use wp_calculate_image_srcset() in tevkori_filter_attachment_image_attributes() to be consistent, but I also wonder if we should allow unnamed sizes passed to wp_get_attachment_image_srcset() to fall back to the full size image to be consistent with the behavior of wp_get_attachment_image().

@joemcgill joemcgill added the bug label Nov 11, 2015
@joemcgill joemcgill added this to the Next release milestone Nov 11, 2015
@joemcgill
Copy link
Member Author

Actually, wp_get_attachment_srcset() does fall back to the full size image, but wp_get_attachment_sizes() returns false, which is why the attributes are not being added.

@jaspermdegroot jaspermdegroot self-assigned this Nov 12, 2015
@jaspermdegroot
Copy link
Member

This issue only happened if no post thumbnail size was specified with set_post_thumbnail_size().
The problem has been fixed already in branch dev by commit 27d1b53 where the sizes function has been split into two functions.

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

No branches or pull requests

2 participants