1

I am working on a theme that shows 200/200px post thumbnail on the home page and 500/300px image on the category page.

Here is what I have in fuctions.php but it doesn't seem to work (only the homepage thumbnail works)

add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 200, 200, true );
add_image_size( 'homepage', 200, 200, true );
add_image_size( 'category', 500, 300, true );
  • 1
    how does the code that outputs the thumbnail look like? – onetrickpony Jan 5 '11 at 17:20
4

Simply naming the size in the functions file is not enough to get the sizes to work: To call a custom size that you added do this:

<?php the_post_thumbnail('category'); ?>

I see you set_post_thumbnail_size(200, 200, true) which you don't need to do if you're also naming a post thumnail size the same sizes for homepage. Perhaps this line is messing up your other sizes.

Also, the_post_thumbnail doesn't usually work on images already uploaded. To test if the sizes truly aren't working upload a new file after adding the new thumbnail size/calling it in your theme file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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