WordPress.org

Make WordPress Core

Ticket #24307: 24307.1.1.diff

File 24307.1.1.diff, 984 bytes (added by obenland, 14 months ago)

Patch builds on lancewillett's patch, cropping the image and serving only thumbnails on mobile views, where we display galleries in two columns of thumbnail sized images.

  • wp-content/themes/twentythirteen/functions.php

     
    9595        add_theme_support( 'post-thumbnails' ); 
    9696        set_post_thumbnail_size( 604, 270, true ); 
    9797 
    98         // Register custom image size for image post formats. 
     98        // Register custom image sizes for image and gallery post formats. 
    9999        add_image_size( 'twentythirteen-image-post', 724, 1288 ); 
     100        add_image_size( 'twentythirteen-gallery-post', 300, 300, true ); 
    100101 
    101102        // This theme uses its own gallery styles. 
    102103        add_filter( 'use_default_gallery_style', '__return_false' ); 
     
    450451 */ 
    451452function twentythirteen_gallery_atts( $atts ) { 
    452453        if ( has_post_format( 'gallery' ) && ! is_single() ) 
    453                 $atts['size'] = 'large'; 
     454                $atts['size'] = wp_is_mobile() ? 'thumbnail' : 'twentythirteen-gallery-post'; 
    454455 
    455456        return $atts; 
    456457}