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 | 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)
Change History (8)
#3
in reply to:
↑ 2
@
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:
↓ 5
↓ 6
@
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
@
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.
#6
in reply to:
↑ 4
@
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.
Actually, not sure if that isn't just intentional. Moving to 3.2.1 for review.