Make WordPress Core

Ticket #49852: 49852.6.patch

File 49852.6.patch, 964 bytes (added by cadic, 12 months ago)

Code styles: Yoda conditions, strict comparison, spacing

  • src/wp-admin/includes/class-wp-media-list-table.php

    diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php
    index 05b2593861..4e0346e7d8 100644
    a b class WP_Media_List_Table extends WP_List_Table { 
    425425        public function column_title( $post ) {
    426426                list( $mime ) = explode( '/', $post->post_mime_type );
    427427
     428                $attachment_id = $post->ID;
     429
     430                if ( 'video' === $mime || 'audio' === $mime ) {
     431                        $thumbnail_id = get_post_thumbnail_id( $post->ID );
     432
     433                        if ( ! empty( $thumbnail_id ) ) {
     434                                $attachment_id = $thumbnail_id;
     435                        }
     436                }
     437
    428438                $title      = _draft_or_post_title();
    429                 $thumb      = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) );
     439                $thumb      = wp_get_attachment_image( $attachment_id, array( 60, 60 ), true, array( 'alt' => '' ) );
    430440                $link_start = '';
    431441                $link_end   = '';
    432442