Skip to content

Instantly share code, notes, and snippets.

@Jehu
Created February 8, 2022 16:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Jehu/249656f6afcfc2d3154b8ddf92775887 to your computer and use it in GitHub Desktop.
Save Jehu/249656f6afcfc2d3154b8ddf92775887 to your computer and use it in GitHub Desktop.
WordPress - Additional Image Sizes
<?php
add_theme_support( 'post-thumbnails' );
add_image_size( 'image-480', 480, 0 );
add_image_size( 'image-640', 640, 0 );
add_image_size( 'image-720', 720, 0 );
add_image_size( 'image-960', 960, 0 );
add_image_size( 'image-1168', 1168, 0 );
add_image_size( 'image-1440', 1440, 0 );
add_image_size( 'image-1920', 1920, 0 );
function mwe_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'image-480' => 'image-480',
'image-640' => 'image-640',
'image-720' => 'image-720',
'image-960' => 'image-960',
'image-1168' => 'image-1168',
'image-1440' => 'image-1440',
'image-1920' => 'image-1920',
) );
}
add_filter( 'image_size_names_choose', 'mwe_custom_sizes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment