[resolved] Post Thumbnail & Twenty Ten theme (14 posts)

  1. elfin

    Posted 5 years ago #

    Playing about with this whilst upgrading my plugin. I've set a Post thumbnail on a single page, and the thumbnail has replaced the header image (currently using the Forest Floor image).

    Don't think this is supposed to happen...

  2. elfin

    Posted 5 years ago #

    then I check the header.php...

    if ( is_singular() && has_post_thumbnail( $post->ID ) ) {
      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 } ?>

    erm what? that's ridiculous! The likely hood of a thumbnail matching the header size for one is unlikely. More importantly Why??

    Very very strange, and I was beginning to like this theme as well.

  3. Geraint Palmer
    Posted 5 years ago #

    The likely hood of a thumbnail matching the header size for one is unlikely.

    actual its not.. the theme will crop any image to the right size if its originally bigger than the header image size, default 940 x 198

    line 39 of functions.php

    // We'll be using them for custom header images on posts and pages
    	// so 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 );

    Its clearly a design feature of that theme. the header image width/height can be overloaded by filter as well twentyten_header_image_width, twentyten_header_image_height lines 13 & 14 of the functions file.

  4. elfin

    Posted 5 years ago #

    I'm still not convinced, I think many users will be posting about this feature and asking how to amend it.

    me, I created a child theme to remove that functionality ;)

  5. Geraint Palmer
    Posted 5 years ago #

    I agree with you that some people won't want this behaviour, but I think the point is to show case all the new features of wp 3.0 and how they could be used. An option to turn it on and off might be an idea.

  6. elfin

    Posted 5 years ago #

    I'd argue that that is a must have ;)

  7. MichaelH
    Posted 5 years ago #

  8. elfin

    Posted 5 years ago #

    I seem to be in the minority about this though, sadly. But hopefully either this thread, or the one in hackers will make someone think about adding in something to make this optional.

  9. MortenBlaabjerg
    Posted 5 years ago #

    Think it is a great feature, but I'd very much like to see it extended to tags and categories as well, so that one might add a featured image/custom header to those types of pages too.

  10. Rev. Voodoo
    Posted 5 years ago #

    I've seen a hack somewhere before that I like...

    One biggie for me, is that I use a lot of smaller images that won't be wide enough to get used.... I think it'd be great if when images that aren't wide enough are used, they still get used in the header, but are floated...

    but that may just be me, and again....I did see a talk of how to do that somewhere....

  11. gfree_au
    Posted 5 years ago #

    I made a post on how I use post thumbnails with twenty ten, works well for me: http://www.keleko.com/2010/setting-up-post-thumbnails-in-wordpress-3-0-with-twenty-ten/

  12. dollypower
    Posted 5 years ago #

    I argee with Rich, I think although it is a nice example of what WP can do. I think it's a odd to have used the thumbnail to implement it. I too would have thought most people would use the "thumbnail" for a smaller image.

    Also, this snippet might be helpful for others, as it will pull in the thumbnail sized thumbnail. If that makes sense!
    <?php the_post_thumbnail('thumbnail'); ?>

  13. elfin

    Posted 5 years ago #

    Since this was posted they changed things, and it now only changes the header if the image is large enough to fill it - which is a lot lot better.

    With child themes you can of course disable the feature it completely.

  14. Alex
    Posted 5 years ago #

    Add this to your functions.php

    add_action( 'init', 'mythumbnail_size' );
    function mythumbnail_size() {
    	add_image_size( 'my-thumbnail', 150, 150 );

    And use this code in your templates
    <?php the_post_thumbnail('my-thumbnail'); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic