#14309 closed enhancement (maybelater)
twentyten_header_image_height hook called before $wp->query()
Reported by: | mikeschinkel | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | General | Keywords: | twenty-eleven |
Focuses: | Cc: |
Description
I don't know if this is anything we can address but the twentyten_header_image_height hook is called within the after_setup_theme hook which is well before wp_query has been set up by $wp->query() and hence functions like is_front_page() are as-of-yet undefined.
Of course the header image height is something that would most likely changed based on whether it's front page or not so I thought I'd bring up this issue (in my current project there is a header only on the front page, no where else.)
Not sure what to suggest about this. Ultimately is_page() returns false even though it is a page and thus is_front_page() returns false. Maybe is_front_page() could test if $wp->query() has been run yet and if not do something different?
Or maybe simply throw an error saying is_front_page() not defined yet. That would be better than others repeating my wasted hour trying to figure out why "obviously correct" logic isn't working. :)
Change History (5)
#1
@
14 years ago
- Summary changed from twentyten_header_image_height hook called before query to twentyten_header_image_height hook called before $wp->query()
I hate the fact that these are constants, but they're remnants from Kubrick actually.
One option would be to unhook twentyten_setup, and move it to init. Cheap, but it would work without any issues I think.
I can't think of a good solution otherwise, unfortunately. The filters are there to alter the size of the header, and your use case is legitimate, but it sounds like something we'll have to consider with Twenty Eleven :-)