*Work in progress post*
You’ll want to make these changes in your theme’s functions.php file. Use an external text editor when messing with PHP files, rather than the dashboard’s handy theme editor.
1. Choose a name for your new image size. In this case, I’m adding tiny game image thumbnails next to a long list of games. I called mine “game thumbnail.”
add_image_size( 'game-thumbnail', 120, 120, true );
Reserved image size names. Don’t use these:
thumb
,thumbnail
,medium
,large
,post-thumbnail
2. There may be a section in your functions.php file with a list of custom image sizes for your theme (the code begins with add_image_size). If you’re editing the theme’s core files (naughty!), then add your new code to the end of that list.
If you don’t see a list of custom image sizes in your functions.php file, that’s okay. Just plop the code below into the bottom of your functions.php file, before the closing PHP tag. Your functions.php file may not have a visible closing tag. If that’s the case, add the code to the last line of the file.
If you’re working with a child theme, you should be able to add the new image code anywhere in the child theme’s functions.php file, after the opening PHP tag.
add_image_size( 'game-thumbnail', 120, 120, true ); add_filter( 'image_size_names_choose', 'my_custom_sizes' ); function my_custom_sizes( $sizes ) { return array_merge( $sizes, array( 'game-thumbnail' => __( 'Game Thumbnail' ), ) ); }
3. I wanted tiny thumbnails, so I chose a size of 120 x 120. “True” gives you a hard crop with exact dimensions. “False” is a soft, proportional crop (more info). You can replace the dimensions, the true/false, and the thumbnail name with a name of your choice. Everything else should remain the same!
4. Test it out by adding an image! If the new thumbnail size doesn’t appear as a dropdown option, use the regenerate thumbnails plugin to give it a little nudge. I had to regen thumbnails to get it to work.
5. BAM! That should do it!