Created
May 10, 2013 12:46
-
-
Save chrisrouse/5554201 to your computer and use it in GitHub Desktop.
This is a pretty cool function. Sometimes the default Medium and Large sizes when inserting an image into a post just isn’t enough range. Maybe you have a special size you use in posts but don’t want to change your Medium and Large file sizes just for that? Well this snippet will allow you to add another image size to the WordPress drop down men…
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
// Set the new image sizes | |
if(function_exists( 'add_image_size')){ | |
add_image_size('blog-large', 900, 700, false); | |
} | |
// Tell the media panel to add the new size to the dropbown | |
function custom_image_sizes($sizes) { | |
$addsizes = array( | |
"blog-large" => __("X-Large") | |
); | |
$newsizes = array_merge($sizes, $addsizes); | |
return $newsizes; | |
} | |
add_filter('image_size_names_choose', 'custom_image_sizes'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment