Ticket #21776: 21776.2.diff
File 21776.2.diff, 6.0 KB (added by , 12 years ago) |
---|
-
wp-includes/script-loader.php
318 318 $scripts->add( 'media-views', "/wp-includes/js/media-views$suffix.js", array( 'media-models', 'wp-plupload' ), false, 1 ); 319 319 did_action( 'init' ) && $scripts->localize( 'media-views', '_wpMediaViewsL10n', array( 320 320 'insertMedia' => __( 'Insert Media' ), 321 'chooseFeatured' => __( 'Choose a Featured Image' ),322 321 'selectMediaSingular' => __( 'Select a media file:' ), 323 322 'selectMediaMultiple' => __( 'Select one or more media files:' ), 324 323 ) ); -
wp-admin/includes/post.php
198 198 set_post_format( $post_ID, false ); 199 199 } 200 200 201 // Featured Images 202 if ( isset( $post_data['thumbnail_id'] ) ) { 203 if ( '-1' == $post_data['thumbnail_id'] ) 204 delete_post_thumbnail( $post_ID ); 205 else 206 set_post_thumbnail( $post_ID, $post_data['thumbnail_id'] ); 207 } 208 201 209 // Meta Stuff 202 210 if ( isset($post_data['meta']) && $post_data['meta'] ) { 203 211 foreach ( $post_data['meta'] as $key => $value ) { -
wp-admin/includes/meta-boxes.php
914 914 $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); 915 915 echo _wp_post_thumbnail_html( $thumbnail_id ); 916 916 } 917 918 /** 919 * Display featured image meta box. 920 * 921 * @since 3.5.0 922 */ 923 function featured_image_meta_box() { 924 global $post, $_wp_additional_image_sizes; 925 926 ?><script type="text/javascript"> 927 jQuery( function($) { 928 var $element = $('#select-featured-image'), 929 $thumbnailId = $element.find('input[name="thumbnail_id"]'), 930 title = '<?php _e( "Choose a Featured Image" ); ?>', 931 workflow, setFeaturedImage; 932 933 setFeaturedImage = function( thumbnailId ) { 934 $element.find('img').remove(); 935 $element.toggleClass( 'has-featured-image', -1 != thumbnailId ); 936 $thumbnailId.val( thumbnailId ); 937 }; 938 939 $element.on( 'click', '.choose, img', function( event ) { 940 event.preventDefault(); 941 942 if ( ! workflow ) { 943 workflow = wp.media(); 944 workflow.selection.on( 'add', function( model ) { 945 var sizes = model.get('sizes'), 946 size; 947 948 setFeaturedImage( model.id ); 949 950 // @todo: might need a size hierarchy equivalent. 951 if ( sizes ) 952 size = sizes['post-thumbnail'] || sizes.medium; 953 954 // @todo: Need a better way of accessing full size 955 // data besides just calling toJSON(). 956 size = size || model.toJSON(); 957 958 workflow.modal.close(); 959 workflow.selection.clear(); 960 961 $( '<img />', { 962 src: size.url, 963 width: size.width 964 }).prependTo( $element ); 965 }); 966 workflow.modal.title( title ); 967 } 968 969 workflow.modal.open(); 970 }); 971 972 $element.on( 'click', '.remove', function( event ) { 973 event.preventDefault(); 974 setFeaturedImage( -1 ); 975 }); 976 }); 977 </script> 978 979 <?php 980 $thumbnail_id = get_post_meta( $post->ID, '_thumbnail_id', true ); 981 $thumbnail_size = isset( $_wp_additional_image_sizes['post-thumbnail'] ) ? 'post-thumbnail' : 'medium'; 982 $thumbnail_html = wp_get_attachment_image( $thumbnail_id, $thumbnail_size ); 983 984 $classes = empty( $thumbnail_id ) ? '' : 'has-featured-image'; 985 986 ?><div id="select-featured-image" 987 class="<?php echo esc_attr( $classes ); ?>" 988 data-post-id="<?php echo esc_attr( $post->ID ); ?>"> 989 <?php echo $thumbnail_html; ?> 990 <input type="hidden" name="thumbnail_id" value="<?php echo esc_attr( $thumbnail_id ); ?>" /> 991 <a href="#" class="choose button-secondary"><?php _e( 'Choose a Featured Image' ); ?></a> 992 <a href="#" class="remove"><?php _e( 'Remove Featured Image' ); ?></a> 993 </div> 994 <?php 995 } 996 No newline at end of file -
wp-admin/edit-form-advanced.php
129 129 add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); 130 130 131 131 if ( current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ) ) 132 add_meta_box(' postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');132 add_meta_box('featuredimagediv', __('Featured Image'), 'featured_image_meta_box', null, 'side', 'low'); 133 133 134 134 if ( post_type_supports($post_type, 'excerpt') ) 135 135 add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', null, 'normal', 'core'); -
wp-admin/css/wp-admin.css
23 23 11.0 - Write/Edit Post Screen 24 24 11.1 - Custom Fields 25 25 11.2 - Post Revisions 26 11.3 - Featured Images 26 27 12.0 - Categories 27 28 13.0 - Tags 28 29 14.0 - Media Screen … … 3239 3240 text-decoration: none; 3240 3241 } 3241 3242 3243 /*------------------------------------------------------------------------------ 3244 11.3 - Featured Images 3245 ------------------------------------------------------------------------------*/ 3242 3246 3247 #select-featured-image { 3248 padding: 4px 0; 3249 overflow: hidden; 3250 } 3251 3252 #select-featured-image img { 3253 max-width: 100%; 3254 height: auto; 3255 margin-bottom: 10px; 3256 } 3257 3258 #select-featured-image a { 3259 float: left; 3260 clear: both; 3261 } 3262 3263 #select-featured-image .remove { 3264 display: none; 3265 margin-top: 10px; 3266 } 3267 3268 #select-featured-image.has-featured-image .remove { 3269 display: inline-block; 3270 } 3271 3243 3272 /*------------------------------------------------------------------------------ 3244 3273 12.0 - Categories 3245 3274 ------------------------------------------------------------------------------*/