twentysixteen icon indicating copy to clipboard operation
twentysixteen copied to clipboard

wp_get_attachment_image_srcset not well implemented in header of twenty sixteen

Open dev-xiligroup opened this issue 8 years ago • 2 comments

attribut srcset in header is not well implemented ! get_custom_header don't have property attachment_id ! Line number 93 of header.php - version 1.2

srcset="<?php echo esc_attr( wp_get_attachment_image_srcset( get_custom_header()->attachment_id ) ); ?>"

to complete : attachment_id property is available if image is coming from media library. But some time images came from theme sub folder (as set in theme (function). A test must be done with this property.

dev-xiligroup avatar Aug 16 '16 06:08 dev-xiligroup

But some time images came from theme sub folder (as set in theme (function).

Why would the custom header image come from your theme folder? The custom header image should be chosen typically via the Customizer. If you are trying to force the header to use your image in a child theme then you'll have to accommodate for that. But that doesn't make this a bug -- unless I misunderstand you.

mathetos avatar Aug 16 '16 15:08 mathetos

you are right it is not a bug but just a notice introduced by this new recent addition of attribute srcset. If child theme uses function register_default_headers (and provides default images), there no way to control attachment_id. Perhaps I need to rewrite header.php in child but it seems more elegant to test if id is set ! (for everybody).

dev-xiligroup avatar Aug 17 '16 07:08 dev-xiligroup