Post Thumbnail Images


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. add_theme_support( 'post-thumbnails' );
  2.  
  3. or
  4.  
  5. add_theme_support( 'post-thumbnails', array( 'post' ) ); // Add it for posts
  6. add_theme_support( 'post-thumbnails', array( 'page' ) ); // Add it for pages
  7.  
  8. set_post_thumbnail_size( 50, 50 ); // 50 pixels wide by 50 pixels tall, box resize mode
  9.  
  10. <?php
  11. if ( has_post_thumbnail() ) {
  12. // the current post has a thumbnail
  13. } else {
  14. // the current post lacks a thumbnail
  15. }
  16. ?>
  17.  
  18.  
  19. <?php the_post_thumbnail(); ?>

URL: http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.