add_theme_support( 'post-thumbnails' );
Default Usage
if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
Thumbnail Sizes
the_post_thumbnail(); // without parameter -> Thumbnail
the_post_thumbnail('thumbnail'); // Thumbnail (default 150px x 150px max)
the_post_thumbnail('medium'); // Medium resolution (default 300px x 300px max)
the_post_thumbnail('large'); // Large resolution (default 640px x 640px max)
the_post_thumbnail( array(100,100) ); // Other resolutions
Example of a new Post Thumbnail size named "category-thumb".
add_image_size( 'category-thumb', 300, 9999 ); //300 pixels wide (and unlimited height)
Here is an example of how to use this new Post Thumbnail size in theme template files.
the_post_thumbnail( 'category-thumb' );
No comments:
Post a Comment