• I have changed it around so the featured images are shown on the homepage along with the excerpt, but whenver I go to view an individual post the featured image does not show up at all.

    I have modified the header of my child theme so that it doesnt set the featured image as the header image by commenting out line //echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );.

    How can I display a featured image on a single post?

Viewing 3 replies - 1 through 3 (of 3 total)
  • I have changed it around so the featured images are shown on the homepage along with the excerpt

    what code in what template have you edited?

    are you using a child theme?

    have you adapted content-single.php?

    Thread Starter 1200ug

    (@1200ug)

    I commented out the code echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );. so it looks like this

    if ( is_singular() && has_post_thumbnail( $post->ID ) &&
    							( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), array( $header_image_width, $header_image_width ) ) ) &&
    							$image[1] >= $header_image_width && 1==2) :
    						// Houston, we have a new header image!
    						 // echo get_the_post_thumbnail( $post->ID, 'post-thumbnail' );
    					else :
    						// Compatibility with versions of WordPress prior to 3.4.
    						if ( function_exists( 'get_custom_header' ) ) {
    							$header_image_width  = get_custom_header()->width;
    							$header_image_height = get_custom_header()->height;
    						} else {
    							$header_image_width  = HEADER_IMAGE_WIDTH;
    							$header_image_height = HEADER_IMAGE_HEIGHT;
    						}
    						?>
    					<img src="<?php header_image(); ?>" width="<?php echo $header_image_width; ?>" height="<?php echo $header_image_height; ?>" alt="" />
    				<?php endif; // end check for featured image or standard header ?>

    Yes, I am using a child theme of Twenty eleven.

    Yes I have now edited the content_single.php and included the post thumbnail at the top:

    article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    	<header class="entry-header">
    		<?php the_post_thumbnail(); ?>
    		<h1 class="entry-title"><?php the_title(); ?></h1>

    thanks very much for your help!!

    One more question, is it possible to show sidebar widgets on content_single.php?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Featured image Twenty Eleven’ is closed to new replies.