Make WordPress Core

Ticket #36191: 36191.patch

File 36191.patch, 2.1 KB (added by joemcgill, 8 years ago)

Add srcset and sizes to WP_Customize_Media_Control::content_template()

  • src/wp-includes/customize/class-wp-customize-media-control.php

    diff --git src/wp-includes/customize/class-wp-customize-media-control.php src/wp-includes/customize/class-wp-customize-media-control.php
    index bcd8db8..d306529 100644
    class WP_Customize_Media_Control extends WP_Customize_Control { 
    158158                                <div class="container">
    159159                                        <div class="attachment-media-view attachment-media-view-{{ data.attachment.type }} {{ data.attachment.orientation }}">
    160160                                                <div class="thumbnail thumbnail-{{ data.attachment.type }}">
    161                                                         <# if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.medium ) { #>
    162                                                                 <img class="attachment-thumb" src="{{ data.attachment.sizes.medium.url }}" draggable="false" alt="" />
     161                                                        <# if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.medium && data.attachment.sizes.large && data.attachment.sizes.full ) { #>
     162                                                                <img class="attachment-thumb" src="{{ data.attachment.sizes.medium.url }}" srcset="{{ data.attachment.sizes.medium.url }} {{ data.attachment.sizes.medium.width }}w, {{ data.attachment.sizes.large.url }} {{ data.attachment.sizes.large.width }}w, {{ data.attachment.sizes.full.url }} {{ data.attachment.sizes.full.width }}w" sizes="(max-width: 640px) calc(100vw - 24px), 273px" draggable="false" alt="" />
     163                                                        <# } else if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.medium && data.attachment.sizes.full ) { #>
     164                                                                <img class="attachment-thumb" src="{{ data.attachment.sizes.medium.url }}" srcset="{{ data.attachment.sizes.medium.url }} {{ data.attachment.sizes.medium.width }}w, {{ data.attachment.sizes.full.url }} {{ data.attachment.sizes.full.width }}w"  sizes="(max-width: 640px) calc(100vw - 24px), 273px" draggable="false" alt="" />
    163165                                                        <# } else if ( 'image' === data.attachment.type && data.attachment.sizes && data.attachment.sizes.full ) { #>
    164166                                                                <img class="attachment-thumb" src="{{ data.attachment.sizes.full.url }}" draggable="false" alt="" />
    165167                                                        <# } else if ( 'audio' === data.attachment.type ) { #>