Last active
August 29, 2015 14:25
-
-
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/
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*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