Skip to content
This repository has been archived by the owner on May 23, 2018. It is now read-only.

wp_get_attachment_image_srcset not well implemented in header of twenty sixteen #484

Open
dev-xiligroup opened this issue Aug 16, 2016 · 2 comments

Comments

@dev-xiligroup
Copy link

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
Copy link
Contributor

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
Copy link
Author

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

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

No branches or pull requests

2 participants