WordPress.org

Make WordPress Core

Changeset 27657


Ignore:
Timestamp:
03/23/14 02:34:39 (4 years ago)
Author:
wonderboymusic
Message:

Turn on thumbnail support for attachment:audio and attachment:video. Change conditionals to check for theme OR post type support when determining whether to turn on the Featured Image UI pieces in the admin.

Fixes #27460.

Location:
trunk/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-form-advanced.php

    r27469 r27657  
    2525$action = isset($action) ? $action : ''; 
    2626 
    27 $media_type = false; 
    28 if ( 'attachment' === $post_type && $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 ) { 
     27$media_support = theme_supports_thumbnails( $post ) || post_supports_thumbnails( $post ); 
     28 
     29if ( post_type_supports( $post_type, 'editor' ) || post_type_supports( $post_type, 'thumbnail' ) || $media_support ) { 
    3430    add_thickbox(); 
    3531    wp_enqueue_media( array( 'post' => $post_ID ) ); 
     
    170166    add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core'); 
    171167 
    172 $audio_post_support = $video_post_support = false; 
    173 $theme_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' ); 
    174 if ( 'attachment' === $post_type && ! empty( $post->post_mime_type ) ) { 
    175     $audio_post_support = 0 === strpos( $post->post_mime_type, 'audio/' ) && current_theme_supports( 'post-thumbnails', 'attachment:audio' ) && post_type_supports( 'attachment:audio', 'thumbnail' ); 
    176     $video_post_support = 0 === strpos( $post->post_mime_type, 'video/' ) && current_theme_supports( 'post-thumbnails', 'attachment:video' ) && post_type_supports( 'attachment:video', 'thumbnail' ); 
    177 } 
    178  
    179 if ( $theme_support || $audio_post_support || $video_post_support ) 
     168if ( current_theme_supports( 'post-thumbnails', $post_type ) || post_supports_thumbnails( $post ) ) 
    180169    add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low'); 
    181170 
  • trunk/src/wp-admin/includes/image.php

    r27472 r27657  
    128128    } elseif ( preg_match( '#^video/#', get_post_mime_type( $attachment ) ) ) { 
    129129        $metadata = wp_read_video_metadata( $file ); 
    130         $support = current_theme_supports( 'post-thumbnails', 'attachment:video' ) && post_type_supports( 'attachment:video', 'thumbnail' ); 
     130        $support = current_theme_supports( 'post-thumbnails', 'attachment:video' ) || post_type_supports( 'attachment:video', 'thumbnail' ); 
    131131    } elseif ( preg_match( '#^audio/#', get_post_mime_type( $attachment ) ) ) { 
    132132        $metadata = wp_read_audio_metadata( $file ); 
    133         $support = current_theme_supports( 'post-thumbnails', 'attachment:audio' ) && post_type_supports( 'attachment:audio', 'thumbnail' ); 
     133        $support = current_theme_supports( 'post-thumbnails', 'attachment:audio' ) || post_type_supports( 'attachment:audio', 'thumbnail' ); 
    134134    } 
    135135 
  • trunk/src/wp-includes/media.php

    r27655 r27657  
    24462446        ); 
    24472447 
    2448         if ( theme_supports_thumbnails( $post ) && post_supports_thumbnails( $post ) ) { 
     2448        if ( theme_supports_thumbnails( $post ) || post_supports_thumbnails( $post ) ) { 
    24492449            $featured_image_id = get_post_meta( $post->ID, '_thumbnail_id', true ); 
    24502450            $settings['post']['featuredImageId'] = $featured_image_id ? $featured_image_id : -1; 
  • trunk/src/wp-includes/post.php

    r27473 r27657  
    7575        'supports' => array( 'title', 'author', 'comments' ), 
    7676    ) ); 
     77    add_post_type_support( 'attachment:audio', 'thumbnail' ); 
     78    add_post_type_support( 'attachment:video', 'thumbnail' ); 
    7779 
    7880    register_post_type( 'revision', array( 
Note: See TracChangeset for help on using the changeset viewer.