Skip to content

Instantly share code, notes, and snippets.

@vijujohns
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vijujohns/294252194065fa06eb13 to your computer and use it in GitHub Desktop.
Save vijujohns/294252194065fa06eb13 to your computer and use it in GitHub Desktop.
Enable Custom Image Size in WordPress Media Insert Dialog http://www.wppicker.com/how-to-enable-custom-image-sizes-in-add-media-dialog/
/*add a custom image size, I'm calling it 'new-size'*/
//if ( function_exists( 'add_image_size' ) ) {
//add_image_size( 'new-size', 300, 100, true ); //(cropped)
//}
/*enable the 'new-size' in Insert Media Dialog*/
add_filter('image_size_names_choose', 'my_image_sizes');
function my_image_sizes($sizes) {
$addsizes = array(
"new-size" => __( "New Size")
);
$newsizes = array_merge($sizes, $addsizes);
return $newsizes;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment