WordPress.org

Make WordPress Core

Ticket #23695: 23695.diff

File 23695.diff, 823 bytes (added by obenland, 5 years ago)
  • wp-includes/media.php

     
    778778        $i = 0;
    779779        foreach ( $attachments as $id => $attachment ) {
    780780                $link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
     781                $image_meta  = wp_get_attachment_metadata( $id );
     782                $orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
    781783
    782784                $output .= "<{$itemtag} class='gallery-item'>";
    783785                $output .= "
    784                         <{$icontag} class='gallery-icon'>
     786                        <{$icontag} class='gallery-icon {$orientation}'>
    785787                                $link
    786788                        </{$icontag}>";
    787789                if ( $captiontag && trim($attachment->post_excerpt) ) {