Do not edit the Twenty Eleven theme. It is the default WordPress 3.2 theme and having access to an unedited version of the theme is vital when dealing with a range of site issues.
Create a child theme for your customisations. Once your child theme is active, see this article.
The image is inserted using the following code in header.php
:
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
if ( is_singular() && current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail( $post->ID ) && ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) && $image[1] >= HEADER_IMAGE_WIDTH ) :
// Houston, we have a new header image!
echo get_the_post_thumbnail( $post->ID );
elseif ( get_header_image() ) : ?>
<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
<?php endif; ?>
You best bet is probably is probably either to redefine the constants HEADER_IMAGE_WIDTH
and HEADER_IMAGE_HEIGHT
or to just hard code in the image you want.
As it’s the twentyten theme, you really *must* do this in a child theme.
HTH
PAE
@peredur
When i redefine the constants HEADER_IMAGE_WIDTH
and HEADER_IMAGE_HEIGHT
by creating a functions.php inside the child theme there is a “Cannot Redeclare Error”.
First off, of course, esmi is correct.
As for the constants, I’m sorry, I misled you. You can’t redefine a constant. You need to make sure that the function in which the constants are defined is overwritable. I.e. it should be surrounded by:
if(!function_exists('function_name')) {
...
}
That being the case, you can create another function of the same name in your child theme by copying the old one into your functions.php
file and changing the bits you need to change.
In twentyten the function is called twentyten_setup()
. I’m not sure about twentyeleven, but it should be similar.
Sorry about the confusion
Cheers
PAE
Thank you guys! It works! ^_^v