0

Hi I just started today on creating my first Wordpress Theme and I am trying to create a featured Image for each post.Aldo I have managed to acomplish that it seems that the sizes I am giving it are not taking effect.Here is my code:

if(function_exists('add_theme_support')){
   add_theme_support('post-thumbnails' , array('post'));
   set_post_thumbnail_size(200,120);
}

if(function_exists('has_post_thumbnail') && has_post_thumbnail()){
      the_post_thumbnail();
}

It seems that my featured images are not always set to the same size.For example if the image is smaller then what size I set it will remain the same , for big images the width is the same but for some the height is different.

What am I doing wrong here?

1 Answer 1

1

It's default behaviour that the images aren't scaled up. Easiest way would be to use simple CSS to scale it up.

How to scale up featured post thumbnail?

For the second part set the crop parameter of set_post_thumbnail_size to true.

set_post_thumbnail_size( 200, 120, true );

http://codex.wordpress.org/Function_Reference/set_post_thumbnail_size

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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