Take the 2-minute tour ×

In my index.php file, I'm trying to create a thumbnail for each post with the size width: 200px and height 142px.

And on the single.php, I would ike for the featured image to be width: 598px and height: 300px;

for the index.php i tried <?php the_post_thumbnail( array (200,150) );?> but I cant get it to work.

Is this something timthumb would be used for? or would it not be needed?

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

For this situation, you should use add_image_size. You can find more info about it in the codex. What add_image_size does is register new sizes for your thumbnails, so you can use them with the_post_thumbnail (and other functions). Here´s the example from the codex:

if ( function_exists( 'add_image_size' ) ) {

You must enter this code in your functions.php file. What this does is register a new size called "category-thumb" with 300pixels in width and unlimited height. You can then call the new registered image size using something like:

the_post_thumbnail( 'category-thumb' );

If after doing this you notice that your thumbnails are still the same size, that's probably because Wordpress already created the thumbnails for that picture, so you need to create new ones. I recommend using the Regenerate Thumbnails Plugin for this purpose. However, I read that this plugin has some security issues (can't confirm if it's true), so what I usually do is activate the plugin to regenerate my thumbnails, and unistall it after I used it. Hope this helps.

share|improve this answer
thanks! it seems ot be working the way i want it to –  Joe Bobby Oct 22 '12 at 19:57
add comment

Your Answer


