Changeset 27209
- Timestamp:
- 02/20/2014 05:49:30 PM (11 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/edit-form-advanced.php
r27036 r27209 25 25 $action = isset($action) ? $action : ''; 26 26 27 if ( post_type_supports($post_type, 'editor') || post_type_supports($post_type, 'thumbnail') ) { 27 $media_type = false; 28 if ( 'attachment' && $post_ID ) { 29 $post = get_post( $post_ID ); 30 $media_type = post_supports_thumbnails( $post ); 31 } 32 33 if ( post_type_supports( $post_type, 'editor' ) || post_type_supports( $post_type, 'thumbnail' ) || $media_type ) { 28 34 add_thickbox(); 29 35 wp_enqueue_media( array( 'post' => $post_ID ) ); -
trunk/src/wp-includes/media.php
r27140 r27209 2013 2013 ); 2014 2014 2015 if ( current_theme_supports( 'post-thumbnails', $post->post_type ) && post_type_supports( $post->post_type, 'thumbnail') ) {2015 if ( theme_supports_thumbnails( $post ) && post_supports_thumbnails( $post ) ) { 2016 2016 $featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true ); 2017 2017 $settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1; … … 2241 2241 * If an attachment is missing its metadata, try to regenerate it 2242 2242 * 2243 * @since 3.9.0 2244 * 2243 2245 * @param post $attachment Post object. 2244 2246 */ … … 2260 2262 } 2261 2263 } 2264 2265 /** 2266 * Determine if a post supports thumbnails based on the passed $post 2267 * 2268 * @since 3.9.0 2269 * 2270 * @param WP_Post $post 2271 * 2272 * @return boolean 2273 */ 2274 function post_supports_thumbnails( $post ) { 2275 if ( 'attachment' === $post->post_type ) { 2276 if ( 0 === strpos( $post->post_mime_type, 'audio' ) ) { 2277 return post_type_supports( 'attachment:audio', 'thumbnail' ); 2278 } elseif ( 0 === strpos( $post->post_mime_type, 'video' ) ) { 2279 return post_type_supports( 'attachment:video', 'thumbnail' ); 2280 } 2281 } 2282 2283 return post_type_supports( $post->post_type, 'thumbnail' ); 2284 } 2285 2286 /** 2287 * Determine if a theme supports thumbnails based on the passed $post 2288 * 2289 * @since 3.9.0 2290 * 2291 * @param WP_Post $post 2292 * 2293 * @return boolean 2294 */ 2295 function theme_supports_thumbnails( $post ) { 2296 if ( 'attachment' === $post->post_type ) { 2297 if ( 0 === strpos( $post->post_mime_type, 'audio' ) ) { 2298 return current_theme_supports( 'post-thumbnails', 'attachment:audio' ); 2299 } elseif ( 0 === strpos( $post->post_mime_type, 'video' ) ) { 2300 return current_theme_supports( 'post-thumbnails', 'attachment:video' ); 2301 } 2302 } 2303 2304 return current_theme_supports( 'post-thumbnails', $post->post_type ); 2305 }
Note: See TracChangeset
for help on using the changeset viewer.