Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save coffeepostal/d9d7623b23ed2a1b43d3846dfa9f2858 to your computer and use it in GitHub Desktop.
Save coffeepostal/d9d7623b23ed2a1b43d3846dfa9f2858 to your computer and use it in GitHub Desktop.
WordPress - functions.php: Add custom images sizes to dropdown media menu
// Add custom image sizes
add_image_size( 'icon', 40, 40, true );
add_image_size( 'icon2x', 80, 80, true );
add_filter('image_size_names_choose', 'my_image_sizes');
function my_image_sizes($sizes) {
$addsizes = array(
"icon" => __( "Icon"),
"icon2x" => __( "Icon@2x")
);
$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