Make WordPress Core

Opened 14 years ago

Closed 14 years ago

Last modified 14 years ago

#14309 closed enhancement (maybelater)

twentyten_header_image_height hook called before $wp->query()

Reported by: mikeschinkel's profile 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 @mikeschinkel
14 years ago

  • Summary changed from twentyten_header_image_height hook called before query to twentyten_header_image_height hook called before $wp->query()

#2 @nacin
14 years ago

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

#3 @westi
14 years ago

  • Keywords twentyeleven added
  • Milestone Awaiting Review deleted
  • Resolution set to maybelater
  • Status changed from new to closed

We're not going to change TwentyTen now.

I agree we should leave this for TwentyEleven.

#4 @westi
14 years ago

  • Keywords twenty-eleven added; twentyeleven removed

#5 @iandstewart
14 years ago

  • Cc ian@… added

Has there been any further thoughts about how to better address this in Twenty Eleven?

Note: See TracTickets for help on using tickets.