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.

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?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

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

share|improve this answer
add comment

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.