WordPress / twentysixteen

Twenty Sixteen is a theme now included in all WordPress installs. To report any issues please go here: https://core.trac.wordpress.org/newticket
324 stars 150 forks source link

wp_get_attachment_image_srcset not well implemented in header of twenty sixteen #484

Open dev-xiligroup opened 8 years ago

dev-xiligroup commented 8 years ago

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.

mathetos commented 8 years ago

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.

dev-xiligroup commented 8 years ago

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).