Просмотр исходного кода

Update functions.php

Added ability to use dropdown menu from media manager when someone adds an image in the content block.
sixfootjames 12 лет назад
Родитель
Сommit
c12d486ed8
1 измененных файлов с 18 добавлено и 0 удалено
  1. 18 0
      functions.php

+ 18 - 0
functions.php

@@ -50,6 +50,7 @@ require_once( 'library/custom-post-type.php' ); // you can disable this if you l
 // Thumbnail sizes
 // Thumbnail sizes
 add_image_size( 'bones-thumb-600', 600, 150, true );
 add_image_size( 'bones-thumb-600', 600, 150, true );
 add_image_size( 'bones-thumb-300', 300, 100, true );
 add_image_size( 'bones-thumb-300', 300, 100, true );
+
 /*
 /*
 to add more sizes, simply copy a line from above
 to add more sizes, simply copy a line from above
 and change the dimensions & name. As long as you
 and change the dimensions & name. As long as you
@@ -70,6 +71,23 @@ You can change the names and dimensions to whatever
 you like. Enjoy!
 you like. Enjoy!
 */
 */
 
 
+add_filter( 'image_size_names_choose', 'bones_custom_image_sizes' );
+
+function bones_custom_image_sizes( $sizes ) {
+    return array_merge( $sizes, array(
+        'bones-thumb-600' => __('600px by 150px'),
+        'bones-thumb-300' => __('300px by 100px'),
+    ) );
+}
+
+/*
+The function above adds the ability to use the dropdown menu to select 
+the new images sizes you have just created from within the media manager 
+when you add media to your content blocks. If you add more image sizes, 
+duplicate one of the lines in the array and name it according to your 
+new image size.
+*/
+
 /************* ACTIVE SIDEBARS ********************/
 /************* ACTIVE SIDEBARS ********************/
 
 
 // Sidebars & Widgetizes Areas
 // Sidebars & Widgetizes Areas