Pass the default mime-type icon as the image for a track when a featured image is not selected for an item in a playlist. Image display in general can be toggled on/off in the modal via Playlist Settings.
Fixes #27525. Built from https://develop.svn.wordpress.org/trunk@27735 git-svn-id: http://core.svn.wordpress.org/trunk@27572 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
b1316b9392
commit
3171da9986
|
@ -1194,9 +1194,6 @@ function wp_get_playlist( $attr, $type ) {
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
|
|
||||||
$supports_thumbs = ( current_theme_supports( 'post-thumbnails', "attachment:$type" ) && post_type_supports( "attachment:$type", 'thumbnail' ) )
|
|
||||||
|| $images;
|
|
||||||
|
|
||||||
$outer = 22; // default padding and border of wrapper
|
$outer = 22; // default padding and border of wrapper
|
||||||
|
|
||||||
$default_width = 640;
|
$default_width = 640;
|
||||||
|
@ -1255,13 +1252,19 @@ function wp_get_playlist( $attr, $type ) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $supports_thumbs ) {
|
if ( $images ) {
|
||||||
$id = get_post_thumbnail_id( $attachment->ID );
|
$id = get_post_thumbnail_id( $attachment->ID );
|
||||||
if ( ! empty( $id ) ) {
|
if ( ! empty( $id ) ) {
|
||||||
list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'full' );
|
list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'full' );
|
||||||
$track['image'] = compact( 'src', 'width', 'height' );
|
$track['image'] = compact( 'src', 'width', 'height' );
|
||||||
list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'thumbnail' );
|
list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'thumbnail' );
|
||||||
$track['thumb'] = compact( 'src', 'width', 'height' );
|
$track['thumb'] = compact( 'src', 'width', 'height' );
|
||||||
|
} else {
|
||||||
|
$src = wp_mime_type_icon( $attachment->ID );
|
||||||
|
$width = 48;
|
||||||
|
$height = 64;
|
||||||
|
$track['image'] = compact( 'src', 'width', 'height' );
|
||||||
|
$track['thumb'] = compact( 'src', 'width', 'height' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue