Skip to content

Instantly share code, notes, and snippets.

@jonkpirateboy
Last active August 29, 2015 14:19
Show Gist options
  • Save jonkpirateboy/ffdd0299cf047923091b to your computer and use it in GitHub Desktop.
Save jonkpirateboy/ffdd0299cf047923091b to your computer and use it in GitHub Desktop.
Make custom image sizes chooseable from admin
function fmd_image_sizes() {
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'bigger_thumbnail', 300, 300, true ); //will be visible in admin
add_image_size( 'carousel', 1300, 380, true ); //will not be visible in admin
}
}
add_action( 'init', 'fmd_image_sizes' );
function fmd_chooseable_image_sizes( $sizes ) {
return array_merge( $sizes, array(
'bigger_thumbnail' => __('Thumbnail, bigger'),
) );
}
add_filter( 'image_size_names_choose', 'fmd_chooseable_image_sizes' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment