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.

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 );
share|improve this question
1  
how does the code that outputs the thumbnail look like? –  onetrickpony Jan 5 '11 at 17:20

1 Answer 1

up vote 4 down vote accepted

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.

share|improve this answer
1  
if you don't want to re-upload all your images again to test you can use this plugin to regenerate all the thumbnails wordpress.org/extend/plugins/regenerate-thumbnails –  Paul Sheldrake Jan 5 '11 at 20:50

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.