WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Disable featured image in header Twenty Ten (3 posts)

  1. zeaks
    Member
    Posted 3 years ago #

    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.

  2. esmi
    Forum Moderator
    Posted 3 years ago #

    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; ?>
  3. zeaks
    Member
    Posted 3 years ago #

    Thanks, I'll give it a try

Topic Closed

This topic has been closed to new replies.

About this Topic