Make WordPress Core

Changeset 23649


Ignore:
Timestamp:
03/08/2013 04:13:15 PM (9 years ago)
Author:
SergeyBiryukov
Message:

Add orientation information to gallery items. props obenland. fixes #23695.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/media.php

    r23626 r23649  
    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}>";
Note: See TracChangeset for help on using the changeset viewer.