1

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.

2

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'); ?>
  • 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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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