Make WordPress Core

Ticket #41884: 41884.diff

File 41884.diff, 1.0 KB (added by AkSDvP, 5 years ago)

Ticket: 41884 - Restrict resizing of thumbnail images in admin section.

  • src/wp-content/themes/twentyseventeen/functions.php

    diff --git a/src/wp-content/themes/twentyseventeen/functions.php b/src/wp-content/themes/twentyseventeen/functions.php
    index 34cad0bbc3..7463adaffe 100644
    a b add_filter( 'get_header_image_tag', 'twentyseventeen_header_image_tag', 10, 3 ); 
    572572 * @return array The filtered attributes for the image markup.
    573573 */
    574574function twentyseventeen_post_thumbnail_sizes_attr( $attr, $attachment, $size ) {
    575         if ( is_archive() || is_search() || is_home() ) {
    576                 $attr['sizes'] = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px';
    577         } else {
    578                 $attr['sizes'] = '100vw';
    579         }
     575
     576        // Restrict resizing of images in admin section.
     577        if ( ! is_admin() ) {
     578
     579                if ( is_archive() || is_search() || is_home() ) {
     580                        $attr['sizes'] = '(max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 543px, 580px';
     581                } else {
     582                        $attr['sizes'] = '100vw';
     583                }
     584        } // end: if is_admin condition
    580585
    581586        return $attr;
    582587}