Make WordPress Core

Opened 13 years ago

Closed 12 years ago

#18006 closed defect (bug) (invalid)

Twenty Eleven header.php size uses width instead of height

Reported by: rvoodoo's profile RVoodoo Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.2
Component: Bundled Theme Keywords:
Focuses: Cc:

Description

has_post_thumbnail( $post->ID ) &&
	( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH ) ) ) &&
	$image[1] >= HEADER_IMAGE_WIDTH ) :
	// Houston, we have a new header image!

The above code, judging by the commented portion should reference SRC , WIDTH, HEIGHT. Instead it references SRC, WIDTH, WIDTH

I believe this might be a simple coding error?

http://wordpress.org/support/topic/twenty-eleven-theme-header-is-this-intentional?replies=2
Is my forum post about it

Attachments (1)

18006.diff (899 bytes) - added by obenland 12 years ago.

Download all attachments as: .zip

Change History (8)

#1 @nacin
13 years ago

  • Milestone changed from Awaiting Review to 3.2.1

Actually, not sure if that isn't just intentional. Moving to 3.2.1 for review.

#2 follow-up: @nacin
13 years ago

  • Component changed from Themes to Bundled Theme

#3 in reply to: ↑ 2 @nacin
13 years ago

  • Milestone changed from 3.2.1 to Awaiting Review

Per Ian, this is intentional to ensure the image is large enough. Pulling it out of the milestone.

#4 follow-ups: @SergeyBiryukov
13 years ago

  • Keywords dev-feedback added

/* $src, $width, $height */ refers to what wp_get_attachment_image_src() returns, not what it takes. However there's some inconsistency between Twenty Ten and Twenty Eleven:

http://core.trac.wordpress.org/browser/tags/3.2.1/wp-content/themes/twentyten/header.php#L69
http://core.trac.wordpress.org/browser/tags/3.2.1/wp-content/themes/twentyeleven/header.php#L86

Twenty Ten checks if current_theme_supports( 'post-thumbnails' ), and then calls
wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ), which seems to serve the same purpose, but looks a bit cleaner.

Not exactly understand why we attempt to get a 1000x1000 pixels image if we only allow 1000x288.

Would like to see this either fixed or properly explained (and then closed as invalid).

#5 in reply to: ↑ 4 @ericlewis
12 years ago

I don't see the logic here either, and infers that wp_get_attachment_image_src() requires an extra large height as argument, not the actual height, potentially for rare image size cases?

Replying to SergeyBiryukov:

Twenty Ten checks if current_theme_supports( 'post-thumbnails' ), and then calls
wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ), which seems to serve the same purpose, but looks a bit cleaner.

Yep. Replacing the conditional with the version from twentyten would be better for code clarity.

Last edited 12 years ago by ericlewis (previous) (diff)

@obenland
12 years ago

#6 in reply to: ↑ 4 @obenland
12 years ago

Replying to SergeyBiryukov:

Would like to see this [...] properly explained (and then closed as invalid).

Both ways, with the image size and the array, will fall back to the full size of the image. If a plugin happens to set the post thumbnail size to something less than 1000px, we end up never having a post thumbnail as a header. This can not happen in Twenty Eleven, since it doesn't use a generic image size.

#7 @SergeyBiryukov
12 years ago

  • Keywords dev-feedback removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.