en el function.php del theme agregar el soporte
add_theme_support( ‘post-thumbnails’ );
se usa dentro del Loop asÃ:
<?php if ( (function_exists(‘has_post_thumbnail’)) && (has_post_thumbnail()) ) {
the_post_thumbnail();
} ?>
USO:
<?php the_post_thumbnail( $size, $attr ); ?>
Parameters
- $size
- (string/array) (Optional) Image size.
- Default: ‘post-thumbnail’, which theme sets usingÂ
set_post_thumbnail_size( $width, $height, $crop_flag );. Either a string keyword(thumbnail, medium, large or full) or a 2-item array representing width and height in pixels, e.g. array(32,32).
- Default: ‘post-thumbnail’, which theme sets usingÂ
- $attr
- (array) (Optional) Array of attribute/value pairs. For details, search source for the function thatÂ
the_post_thumbnailrelies on:Âwp_get_attachment_image
More Options
the_post_thumbnail(); // without parameter -> Thumbnail
the_post_thumbnail('thumbnail'); // Thumbnail
the_post_thumbnail('medium'); // Medium resolution
the_post_thumbnail('large'); // Large resolution
the_post_thumbnail( array(100,100) ); // Other resolutions

