Support » Themes and Templates » Post Images duplicating on top of my header….?

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi

    (@esmi)

    Forum Moderator

    Because that’s how the Twenty Ten theme works. It uses the first image in a post as the header image in a single post page.

    how can I prevent this from happening?

    esmi

    (@esmi)

    Forum Moderator

    Create a child theme, copy header.php from the parent into the child and then edit the header,php file in the child theme to remove the post image on single post pages.

    Thanks, once I removed this code in header.php the images were no longer there.

    <?php
    					// 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; ?>

    esmi

    (@esmi)

    Forum Moderator

    Warning: If you amended the Twenty Ten theme itself, your customisations will be over-written the next time you upgrade WordPress or the theme. For this reason, it is recommended that you consider creating a child theme for your customisations.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Post Images duplicating on top of my header….?’ is closed to new replies.