phpwordpresspostthumbnails

Wordpress different featured image size for different post types


You can enable featured images for posts and set their size by using the following code in your function.php file:

add_theme_support('post-thumbnails');
set_post_thumbnail_size(107, 69, true);

but this sets the image size globally for any post types. Im using wordpress 3.0 and have created my own custom post type. Is it possible to apply a different featured thumbnail sizes for different post types?

Thanks

Scott


Solution

  • In your theme functions file, you can define new image sizes that apply to any images uploaded from then forward:

    add_image_size('new-thumbnail-size',600,340, true)

    Once you've defined a new image size, you can use the_post_thumbnail as usual but include the new image size to display that instead of the thumbnail default:

    the_post_thumbnail( 'new-thumbnail-size' )

    A little bit more detail: http://gavinsmith.me/2010/10/multiple-post-thumbnail-featured-image-sizes-in-wordpress/