Twenty Ten」にある、ヘッダーにアイキャッチ画像を表示する部分を削除します。
参考URL:http://oxynotes.com/?p=1807
削除方法
「header.php」の70行目あたり
| 
 1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
 | 
<?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; ?> | 
という記述を全て削除します。
 復活させたいときはまたコピペしましょう。
この記事を参考に、最終的にtwenty-tenのheader.phpを以下のように変更することで、フロントページと同じ画像が、投稿シングルページにも表示されるようになった。
■オリジナルCodeの赤字を削除:Singular、post-thumbnail部をカット
<?php
 // Compatibility with versions of WordPress prior to 3.4.
 if ( function_exists( ‘get_custom_header’ ) ) {
 /*
 * We need to figure out what the minimum width should be for our featured image.
 * This result would be the suggested width if the theme were to implement flexible widths.
 */
 $header_image_width = get_theme_support( ‘custom-header’, ‘width’ );
 } else {
 $header_image_width = HEADER_IMAGE_WIDTH;
 }
/* /////////////////////////////////////////////////////////// */
 // 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() ) :
 // 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 esc_attr( $header_image_width ); ?>” height=”<?php echo esc_attr( $header_image_height ); ?>” alt=”” />
 <?php endif; ?>
<!– /////////////////////////////////////////////////////////// –>
</div><!– #branding –>
■変更後のコード(青字)
<?php
 // Compatibility with versions of WordPress prior to 3.4.
 if ( function_exists( ‘get_custom_header’ ) ) {
 /*
 * We need to figure out what the minimum width should be for our featured image.
 * This result would be the suggested width if the theme were to implement flexible widths.
 */
 $header_image_width = get_theme_support( ‘custom-header’, ‘width’ );
 } else {
 $header_image_width = HEADER_IMAGE_WIDTH;
 }
/* /////////////////////////////////////////////////////////// */
 // Check if this is a post or page, if it has a thumbnail, and if it’s a big one
 if ( get_header_image() ) :
 // 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 esc_attr( $header_image_width ); ?>” height=”<?php echo esc_attr( $header_image_height ); ?>” alt=”” />
 <?php endif; ?>
<!– /////////////////////////////////////////////////////////// –>
</div><!– #branding –>
  
  
  
  
コメント