mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@27657 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -24,13 +24,9 @@ $post_ID = isset($post_ID) ? (int) $post_ID : 0;
|
||||
$user_ID = isset($user_ID) ? (int) $user_ID : 0;
|
||||
$action = isset($action) ? $action : '';
|
||||
|
||||
$media_type = false;
|
||||
if ( 'attachment' === $post_type && $post_ID ) {
|
||||
$post = get_post( $post_ID );
|
||||
$media_type = post_supports_thumbnails( $post );
|
||||
}
|
||||
$media_support = theme_supports_thumbnails( $post ) || post_supports_thumbnails( $post );
|
||||
|
||||
if ( post_type_supports( $post_type, 'editor' ) || post_type_supports( $post_type, 'thumbnail' ) || $media_type ) {
|
||||
if ( post_type_supports( $post_type, 'editor' ) || post_type_supports( $post_type, 'thumbnail' ) || $media_support ) {
|
||||
add_thickbox();
|
||||
wp_enqueue_media( array( 'post' => $post_ID ) );
|
||||
}
|
||||
@@ -169,14 +165,7 @@ foreach ( get_object_taxonomies( $post ) as $tax_name ) {
|
||||
if ( post_type_supports($post_type, 'page-attributes') )
|
||||
add_meta_box('pageparentdiv', 'page' == $post_type ? __('Page Attributes') : __('Attributes'), 'page_attributes_meta_box', null, 'side', 'core');
|
||||
|
||||
$audio_post_support = $video_post_support = false;
|
||||
$theme_support = current_theme_supports( 'post-thumbnails', $post_type ) && post_type_supports( $post_type, 'thumbnail' );
|
||||
if ( 'attachment' === $post_type && ! empty( $post->post_mime_type ) ) {
|
||||
$audio_post_support = 0 === strpos( $post->post_mime_type, 'audio/' ) && current_theme_supports( 'post-thumbnails', 'attachment:audio' ) && post_type_supports( 'attachment:audio', 'thumbnail' );
|
||||
$video_post_support = 0 === strpos( $post->post_mime_type, 'video/' ) && current_theme_supports( 'post-thumbnails', 'attachment:video' ) && post_type_supports( 'attachment:video', 'thumbnail' );
|
||||
}
|
||||
|
||||
if ( $theme_support || $audio_post_support || $video_post_support )
|
||||
if ( current_theme_supports( 'post-thumbnails', $post_type ) || post_supports_thumbnails( $post ) )
|
||||
add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', null, 'side', 'low');
|
||||
|
||||
if ( post_type_supports($post_type, 'excerpt') )
|
||||
|
||||
Reference in New Issue
Block a user