Skip to content

Instantly share code, notes, and snippets.

@FriendlyWP
Created October 26, 2013 01:39
Show Gist options
  • Save FriendlyWP/7164317 to your computer and use it in GitHub Desktop.
Save FriendlyWP/7164317 to your computer and use it in GitHub Desktop.
Display custom image sizes in Media uploader; insert custom image sizes into posts and pages
// Allows users to insert your custom image sizes via the Add Media button
// In this example, two custom image sizes are added to the defaults
add_filter( 'image_size_names_choose', 'my_custom_sizes' );
function my_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'thumb-narrow' => __('Narrow Thumbnail'),
'thumb-wide' => __('Wide Thumbnail'),
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment