Advertisement
hawaii

Twenty Ten WordPress Theme Header Tweak

May 29th, 2012
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.29 KB | None | 0 0
  1. Disable replacement of the header image with the page/post featured image in the Twenty Ten theme from Automattic in WordPress
  2.  
  3. In the header.php file:
  4.  
  5. <?php
  6. // Check if this is a post or page, if it has a thumbnail, and if it's a big one
  7. if ( is_singular() && current_theme_supports( 'post-thumbnails' ) &&
  8. has_post_thumbnail( $post->ID ) &&
  9. ( /* $src, $width, $height */ $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), 'post-thumbnail' ) ) &&
  10. $image[1] >= HEADER_IMAGE_WIDTH ) :
  11. // Houston, we have a new header image!
  12. echo get_the_post_thumbnail( $post->ID );
  13. elseif
  14. ( get_header_image() ) : ?>
  15. <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
  16. <?php endif; ?>
  17. <div id="site-description"><?php bloginfo( 'description' ); ?></div>
  18. <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
  19.  
  20. Remove everything above from "<?php" through "<?php endif; ?>" so that after:
  21. <div id="site-description"><?php bloginfo( 'description' ); ?></div>
  22.  
  23. There is only:
  24. <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement