add_image_size generator
Custom image sizes, registered correctly.
Genuinely free. No sign-up, no email, no limits, no cookies. We don't store the URL you analyse.
Code
<?php
add_action( 'after_setup_theme', function () {
add_theme_support( 'post-thumbnails' );
add_image_size( 'card_thumb', 600, 400, true );
} );
// Usage in the template: the_post_thumbnail( 'card_thumb' );What it's for
WordPress creates several crops of every uploaded image. To get a custom one you register it with add_image_size and enable thumbnail support. Here you get both lines, correct.
Frequently asked questions
›Do already-uploaded images get the new size?
No: add_image_size only applies to later uploads. For existing images you need a thumbnail-regeneration plugin or WP-CLI.