Skip to content

Instantly share code, notes, and snippets.

@stebrech
Created February 18, 2014 17:12
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 stebrech/9075245 to your computer and use it in GitHub Desktop.
Save stebrech/9075245 to your computer and use it in GitHub Desktop.
WordPress Snippet (für functions.php oder Plugin). Werden zu den Standardgrössen zusätzliche Bildformate definiert, werden diese nicht im Media-Uploader angezeigt. Blogartikel: http://www.pixelstrol.ch/blog/2014/02/wp-snippet-alle-bildgroessen-im-medien-uploader-anzeigen/ Quellen: http://wp-snippets.com/show-custom-image-sizes-in-admin-media-upl…
<?php
function show_image_sizes( $sizes ) {
$new_sizes = array();
$added_sizes = get_intermediate_image_sizes();
// $added_sizes is an indexed array, therefore need to convert it
// to associative array, using $value for $key and $value
foreach( $added_sizes as $key => $value) {
$new_sizes[$value] = $value;
}
// This preserves the labels in $sizes, and merges the two arrays
$new_sizes = array_merge( $new_sizes, $sizes );
return $new_sizes;
}
add_filter('image_size_names_choose', 'show_image_sizes', 11, 1);
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment