Moderator
Jan Dembowski
(@jdembowski)
Forum Moderator and Brute Squad
A link to your site and/or a pastebin.com link to your PHP code would help us.
Apologies, I’m developing it on my localhost.
here’s a link to the pastebin of the sidebar-page.php…
http://pastebin.com/4dXBjpcS
Cheers
I’ve changed everything back to how it was and it worked but when I changed the image size change in the child theme functions.php from the default to 300px wide and 600px high it stopped working again.
Is there a problem with Portrait featured images?
untested – try to change this line to:
( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT ) ) ) &&
Dude, I could kiss you right now.
That worked a charm. You have just saved the very last strands of hair I have left after two days of head butting a wall.
you are welcome 😉
if this is all sorted, please tick the topic off as ‘resolved’ – thanks 😉
PS:
I always wondered why HEADER_IMAGE_WIDTH
(or $header_image_width
resp.) was used twice in that code; now I know …
just in case somebody else wants to have a portrait-sized header image in (a child theme of) Twenty Eleven:
the universal code – to allow for landscape and portrait images – should be:
(for Twenty Eleven 1.4 which is slightly different to the earlier versions)
// Check if this is a post or page, if it has a thumbnail, and if it's a big one
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, max($header_image_width,$header_image_height) ) ) ) &&
$image[1] >= $header_image_width ) :
// Houston, we have a new header image!