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 am working on the WordPress Twenty Ten theme, and I want to display post thumbnails. I have followed the steps below:

  • Added following code in functions.php file:

    if ( function_exists( 'add_theme_support' ) ) { 
        add_theme_support( 'post-thumbnails' ); 
    }
    
  • I have also defined post thumbnail size,

    set_post_thumbnail_size( 150, 150 );
    
  • And I configured the media settings from the admin panel of WordPress to not to crop image. but this is cropping the image.

  • Using this in loop.php file,

    the_post_thumbnail(array(150,150);
    

I do not want to crop the image. How can I do this? Please help where I am wrong in my process.

Thanks in advance.

share|improve this question

migrated from stackoverflow.com Jul 1 '11 at 8:10

This question came from our site for professional and enthusiast programmers.

    
@Dinesh - You've been a member for over a year and you have a 0% accept rate. You should work on that! –  Francois Deschenes Jul 1 '11 at 5:59

3 Answers 3

IF you want to retrieve thumbnail in size that you had set with set_post_thumbnail_size() then call the_post_thumbnail() without passing any arguments.

That will default to named post-thumbnail size that that set_post_thumbnail_size() actually creates.

Also crop for this will be determined by third argument in set_post_thumbnail_size() (defaults to false) and is not tied to media settings (those control entirely different sizes of image).

share|improve this answer

Maybe it's just a typo, use

the_post_thumbnail(array(150,150));

instead of

the_post_thumbnail(array(150,150);

Another thing is, I've never used this in the loop.php only in functions.php

share|improve this answer
    
Thanks, But if i am using the_post_thumbnail(array(150,150)); in functions.php. It is displaying actual image size at lists of posts page.? But i need thumbnail size of 150*150.? –  Dinesh Jul 1 '11 at 6:48
    
Ok, so you can try this: if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 150, 150 ); } and if this does not work for you, maybe there's a conflict with another function. –  Murilo Terrabuio Jul 1 '11 at 7:15

A couple things to try:

  1. Create a new custom image size: add_image_size( 'my-custom-thumb', 150, 150 ); Play around with the dimensions, to see how WordPress reacts. There may be a collision, since there is already a 150x150 image size.

  2. Regenerate your thumbnails, using the Regenerate Thumbnails Plugin or the Ajax Thumbnail Rebuild Plugin.

  3. And, as @Rarst said: remove the array from the call to the_post_thumbnail(); either pass it no parameters, or pass it an image-size-name as an argument.

share|improve this answer
    
+1 for regenerating thumbnails. This step is non-obvious the first time one delves into all this. –  two7s_clash Jul 1 '11 at 17:52

Your Answer

 
discard

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