WordPress.org

Support

Support » Themes and Templates » [Resolved] Disable featured image in header Twenty Ten

[Resolved] Disable featured image in header Twenty Ten

  • I’m using a twenty ten child theme. I was wondering how I can show post thumbnails, but when the post is viewed, not have the image displayed in the header. I just want to use my selected default header.

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

    @esmi

    Forum Moderator

    In your child’s header.php file, change:

    <?php 	// Check if this is a post or page, if it has a thumbnail, and if it's a big one
    	if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
    			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 );
    	elseif ( get_header_image() ) : ?>
    		<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
    	<?php endif; ?>

    to:

    <?php
    	if ( get_header_image() ) : ?>
    		<img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
    	<?php endif; ?>

    Thanks, I’ll give it a try

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Disable featured image in header Twenty Ten’ is closed to new replies.
Skip to toolbar