WordPress.org

Forums

Twenty Ten - Featured images overriding Header image? (13 posts)

  1. atracksler
    Member
    Posted 6 years ago #

    In looking through the functions.php, it seems like the page and post featured images should override the header images...

    // We'll be using post thumbnails for custom header images on posts and pages.
    	// We want them to be 940 pixels wide by 198 pixels tall (larger images will be auto-cropped to fit).
    	set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );

    Wghat do I need to do to make this happen? I have a featured image uploaded to my post and the standard header image is still showing up...

    any ideas?

  2. elfin

    Posted 6 years ago #

    The image need to be of the correct size, or greater, so if it is smaller than 940px wide it won't replace the default header image.

  3. atracksler
    Member
    Posted 6 years ago #

    okay, so my image is larger than the 940 px..

    I have the image in the post and as the "featured image" for the post and still isnt showing up... any other ideas?

  4. elfin

    Posted 6 years ago #

    check the header.php of twentyten

    around line 58 there is a comment like this:
    // Check if this is a post or page, if it has a thumbnail, and if it's a big one

    is that still there in your copy?

  5. atracksler
    Member
    Posted 6 years ago #

    yes

    // 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), 'post-thumbnail')) && $image[1] >= HEADER_IMAGE_WIDTH):
    		// Houston, we have a new header image!
    		echo get_the_post_thumbnail($post->ID, 'post-thumbnail');
    	else:
    
    ?>
          <img src="<?php
    
    		header_image();
    
    ?>" width="<?php
    
    		echo HEADER_IMAGE_WIDTH;
    
    ?>" height="<?php
    
    		echo HEADER_IMAGE_HEIGHT;
    
    ?>" alt="" />
          <?php
    
    	endif;
    
    ?>
        </div>
  6. elfin

    Posted 6 years ago #

    Then it should work. Are you 100% sure you have a featured image set on the relevant page, and it is of the correct dimensions?

  7. atracksler
    Member
    Posted 6 years ago #

    in the backend it is showing in the featured image section and it is bigger than the space allotted....

    is the featured image different than the post thumbnail?

  8. elfin

    Posted 6 years ago #

    Hmmm I just tested it and it is working for me. Strange.

  9. atracksler
    Member
    Posted 6 years ago #

    i did change the thumbnail defaults in functions.php to:

    // The height and width of your custom header. You can hook into the theme's own filters to change these values.
    	// Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.
    	define( 'HEADER_IMAGE_WIDTH', apply_filters( 'twentyten_header_image_width', 879 ) );
    	define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'twentyten_header_image_height', 250 ) );

    could that be causing it?

  10. elfin

    Posted 6 years ago #

    No that should work ok. I just tested my copy and it works ok.

    perhaps you should download a fresh copy of twentyten(it's in the theme directory) and try it without any alterations?

  11. atracksler
    Member
    Posted 6 years ago #

    well, I changed to twentyten (my custom theme is based on 2010... and still no go.

    http://clc.citlchurches.info/2010/06/22/hello-world/

    the image of the dogs tongue is the featured image, as well as inserted into the post...I feel like I'm doing something wrong.....

  12. elfin

    Posted 6 years ago #

    Hadn't realised you were using multisite - however I've just checked and can say that on my test server it still works.

    Have you got any plugins installed that affect thumbnail images?

  13. atracksler
    Member
    Posted 6 years ago #

    i turned off all plugins that had anything to do with images, and still no....

Topic Closed

This topic has been closed to new replies.

About this Topic