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?

1 Answer 1


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' ) ) {
    add_image_size( 'category-thumb', 300, 9999 );

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.


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.