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:
Scott Taylor 2014-03-26 12:45:15 +00:00
parent b1316b9392
commit 3171da9986
1 changed files with 7 additions and 4 deletions

View File

@ -1194,9 +1194,6 @@ function wp_get_playlist( $attr, $type ) {
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
$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 );
if ( ! empty( $id ) ) {
list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'full' );
$track['image'] = compact( 'src', 'width', 'height' );
list( $src, $width, $height ) = wp_get_attachment_image_src( $id, 'thumbnail' );
$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' );
}
}