Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I know how to add a new thumbnail size to my custom plugin. But i want to know if is possible to restrict de new size only to a certain custom post type?

Thanks in advance.

share|improve this question
add comment

1 Answer

You cant without editing core files but you can name it any way you want so you can call it from you plugin:

if ( function_exists( 'add_image_size' ) ) { 
    add_image_size( 'my-plugin-thumb', 220, 180, true );
}

and call it

if ( has_post_thumbnail() ) { 
    the_post_thumbnail( 'my-plugin-thumb' );
}

it's not perfect but its something.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.