-
Notifications
You must be signed in to change notification settings - Fork 6
Proof of concept – using wp_get_attachment_image #71
base: master
Are you sure you want to change the base?
Proof of concept – using wp_get_attachment_image #71
Conversation
|
Related issue #66 |
inc/class-img-shortcode.php
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect it'd be easier to array_intersect_key with a whitelist of allowed attributes than try to unset any potential attributes that wouldn't work here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@goldenapples Agreed, but we would nullify any new attributes added in img_shortcode_attrs. Kosher?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, yeah. true. I can't think offhand what custom attributes you'd want to enable on an image, but in case there are any, we should allow them to pass through. At the very least, you could clean up this logic using array_diff_key.
|
Cleaned up based on @goldenapples' feedback. The tests are failing due to the srcset seemingly affected by This is especially odd to me given the explicit switch and test of I tried setting the theme again inline the test, no dice. Stumped on the |
That is really weird. I think the issue is that I was able to get around this behavior by adding to the setUp() method in that test suite. I'm not sure where you got the sizes you're using in the srcset test, so I'm not sure whether the test assertation is wrong, or if there's another filter that needs to be removed as well...? |
Reworks the
callbackto use WordPress 4.4's new responsive image feature. Images without associated attachment are still generated with the previous method.