• Resolved fateskimo

    (@fateskimo)


    Hi

    I’m having trouble with my featured images in pages not replacing the custom image in the header. I’ve made sure it’s the correct size but it keeps showing the custom uploaded header image from the front page.

    I have moved the code from the header.php to sidebar-page.php as it needs to sit to the right of the content. Could this be the problem? Does the code have to sit inside the header.php?

    Any suggestions would be very welcome.

Viewing 7 replies - 1 through 7 (of 7 total)
  • 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.

    Thread Starter fateskimo

    (@fateskimo)

    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

    Thread Starter fateskimo

    (@fateskimo)

    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 ) ) ) &&
    Thread Starter fateskimo

    (@fateskimo)

    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!

    Thread Starter fateskimo

    (@fateskimo)

    Will do, cheers!!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Featured Image not showing in custom slot’ is closed to new replies.