1

In my function file, I set the following:

if ( function_exists( 'add_theme_support' ) ) {
    add_theme_support( 'post-thumbnails' );
    set_post_thumbnail_size( 150, 50, true );   
}

And in the loop:

<?php the_post_thumbnail();  ?>

But the images are resized proportionally, using the smallest value. The crop is not working.

UPDATE

I change the function:

function resize_thumb () {
   add_theme_support( 'post-thumbnails' );
   set_post_thumbnail_size( 280, 80, true );
}

add_action ( 'after_setup_theme', 'resize_thumb' );

But the desire crop not happens.

SOLVED

In functions.php, I add just this line:

add_image_size( 'thumbnail-news', '190', '40', true );

And in the loop I add this line

<?php the_post_thumbnail( 'thumbnail-news' ); ?>

To resize old images, I use Regenerate Thumbnails plugin.

2

Contrary to Pieter, I'd say your if statement is correct (although, unnecessary). If it's a WordPress theme, then add_theme_support will likely exist!

Have you per chance added the images before setting the post thumbnail size? If so, you need to regenerate your images:

http://wordpress.org/plugins/regenerate-thumbnails/

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.