Post Thumbnails multiple sizes

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 );

Related posts

Leave a Reply

1 comment

  1. 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.