Adding thumbnail sizes

Registering own thumbnails allows for creating additional images sizes, beyond those shipped with WordPress.

Your new image sizes should be registered inside app/Setup/thumbnails.php file with add_image_size function within after_setup_theme action hook.

namespace Tonik\Theme\App\Structure;

function add_image_sizes()
{
  add_image_size('custom-thumbnail', 800, 600, true);
}
add_action('after_setup_theme', 'Tonik\Theme\App\Structure\add_image_sizes');

Usage

Reference name of newly created image size when outputting images.

the_post_thumbnail('custom-thumbnail');
Spotted a mistake or want to contribute to the documentation? Edit this document on Github!