Skip to content
This repository has been archived by the owner on Nov 14, 2024. It is now read-only.

Latest commit

 

History

History
31 lines (24 loc) · 769 Bytes

adding-thumbnail-sizes.md

File metadata and controls

31 lines (24 loc) · 769 Bytes
extends title group subgroup prev next order
docs
Adding thumbnail sizes
Basics
Structure
adding-menus-and-navigations
registering-sidebars
4

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