views:

40

answers:

1

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

A: 

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/

Gavin
I know all this already, but thats not what I asked. if I set a featured image its going to use the size post-thumbnails but what I want to happen is that if Im in a different post type when i use featured image it uses a different size other than post thumbnails.
Brady
That's what I was getting at - if you register your own image sizes, you can edit the instance of your featured image accordingly. You can run an `if elseif else` or a `switch` using `$post->post_type` in your loop - if it's post type A, print `the_post_thumbnail( 'custom-type-A' )`, if it's post type B, print `the_post_thumbnail( 'custom-type-B' )`. That any better?
Gavin