Support » Themes and Templates » How to use original size image for header as Twenty Twelve does?

  • Hello,

    I’m trying to port Twenty Eleven custom header for post/page feature to Twenty Twelve. I combined the code from both themes in header.php, but for some reason post/page header is inserted as Large, not as original as Twenty Twelve does. Here is the original Twenty Twelve code:

    Here is my header.php code:

    Looks like this part is responsible:

    if ( is_singular() && 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!
    		echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );

    What should I change so I could get the output with image of full size and without width and height specified?

    Also in Twenty eleven code the part array( $header_image_width, $header_image_width ) looks like mistake, because width is written twice, unless there is some kind of hack.

    Here is the default header – works OK:

    Post/page header is inserted as Large:

    Thank you for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • paulwpxp


    Font hero

    It’s this line (#L19 of )

    echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );

    The post-thumbnail size is set in TwentyTwelve’s function.php as 624px, so what you see is not size = large, what you see is size = post-thumbnail = 624px.

    I would change it to full AND upload the image with exact 960px only, ( this is my personal default image dimension used for web )


    I would change it to large AND set the value of large in Admin > Media settings as 960px.


    you can alter the post-thumbnail size set in TwentyTwelve to be 960px instead of 624px, but you will lose the 624px that used in normal post.


    register new image size and use that in #L19

    Thank you, Paul!

    I tried with full and it worked, but just to make it easy for people who may not have graphic software to prepare image with special dimensions, I will register new size (also with 960px), so it will be super easy 🙂

    Thank you again!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How to use original size image for header as Twenty Twelve does?’ is closed to new replies.