Make WordPress Core

Ticket #49852: 49852.2.patch

File 49852.2.patch, 854 bytes (added by samful, 3 years ago)

samful's patch for video and audio thumbnails not appearing on list view

  • class-wp-media-list-table.php

    diff --git class-wp-media-list-table.php class-wp-media-list-table.php
    index cc8940a..90a01d0 100644
    class WP_Media_List_Table extends WP_List_Table { 
    380380        public function column_title( $post ) {
    381381                list( $mime ) = explode( '/', $post->post_mime_type );
    382382
     383                $attachment_id = $post->ID;
     384
     385                if($mime == 'video' || $mime == 'audio'){
     386                        $thumbnail_id = get_post_thumbnail_id($post->ID);
     387                       
     388                        if(!empty($thumbnail_id)){
     389                                $attachment_id = $thumbnail_id;
     390                        }
     391                }
     392
    383393                $title      = _draft_or_post_title();
    384                 $thumb      = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) );
     394                $thumb      = wp_get_attachment_image( $attachment_id, 'array( 60, 60 )', true, array( 'alt' => '' ) );
    385395                $link_start = '';
    386396                $link_end   = '';
    387397