Featured image thumbnail sometimes in content, sometimes changes header images

I am using wordpress 3.1 and when I use the featured image metabox to upload sometimes I see in my posts the image as part of the content and sometimes the header image changes as well. I cannot understand what is the reason. Any help will be appreciated.

I am using

Read More
    if ( has_post_thumbnail() ) 
{ // check if the post has a Post Thumbnail assigned to it.
    the_post_thumbnail();
} 

Update

sorry i got confused with the editor. anyway what i need right now is to display the thumbnail in a size of 300×300 but have a larger image to display when the user clicks on the thumbnail. i saw the loop-attachment.php and i think i have to use this one.

<?php $attachment_page = get_attachment_link( $attachment_id ); ?>
                <?php $thumb=get_the_post_thumbnail(); ?>
                    <a href="<?php echo $attachment_page; ?>">
                    <?php the_post_thumbnail();?>
                    </a>

but it is not working. i dont know if i have to post it as a new question also.

Related posts

Leave a Reply

1 comment

  1. Assuming you are using Twenty Ten, Twenty Eleven, or one of the several Themes that derive Post Thumbnail (i.e. “featured image”) feature handling from either of these Themes:

    • The Featured Image is applied to the header image, if and only if the dimensions of the Featured Image exceed the dimensions of the header image.
    • The Featured Image is not displayed in the Post Content by default; you must manually insert the Featured Image into the Post Content, as you would any other image, if you want it to appear in your Post.

    EDIT

    To have a custom image size, such as 300×300, you can use add_image_size(). For example, add the following to functions.php:

    add_image_size( 'single-post-image', 300, 300, true );

    Then, in single.php, you can add:

    <?php the_post_thumbnail( 'single-post-image' ); ?>

    And your 300x300px image will be inserted wherever you place it.

    (Note: you may need to regenerate existing Thumbnails.)

    EDIT

    To link your displayed, custom-sized featured image to its attachment-page view, you need to use get_attachment_link(). In single.php:

    <?php if ( has_post_thumbnail() ) { ?>
        <a href="<?php echo get_attachment_link( get_post_thumbnail_id() ); ?>">
        <?php the_post_thumbnail( 'single-post-image' ); ?>
        </a>
    <?php } ?>