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.

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.

Note: I'm using roots theme.

share|improve this question

1 Answer 1

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/

share|improve this answer

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.