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 have a custom post type, and I'm adding support for thumbnails (featured image)

        register_post_type('cp_companies', array(
            'labels' => array(
                'name' => __('Companies'),
                'singular_name' => __('Company')
            ),
            'public' => true,
            'has_archive' => true,
            'supports' => array('thumbnail', 'title', 'editor')
                )
        );

This is not a theme. This is a plug-in. What I want to do is simply limit (120x120) the size of the featured image.

share|improve this question
add comment

1 Answer 1

up vote 2 down vote accepted

From what I understand, you just want to have a thumb created at 120 x 120 when an image is uploaded using the new post type. Then use that image as the featured image on the custom post pages.

Just add a new image size

add_image_size( 'companies_thumb', 120, 120, true);

Then in the post type template for companies you just call the thumb you defined.

<?php the_post_thumbnail('companies_thumb'); ?>
share|improve this answer
    
Yeah, get that. But this will leave the user free and let him upload any size he wants, right? I'm looking for a way to limit the user. –  Omar Abid Nov 3 '11 at 15:36
    
Yes, he can upload any size.. but when its uploaded, wp will create an thumb version of the original that is 120x120. The image that displays on the custom post will always be 120x120 since that's the one you are calling. –  Andy James Nov 3 '11 at 15:41
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.