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

git-svn-id: https://develop.svn.wordpress.org/trunk@23649 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2013-03-08 16:13:15 +00:00
parent 8bcef0d438
commit 82b5f9e128

View File

@ -778,10 +778,12 @@ function gallery_shortcode($attr) {
$i = 0;
foreach ( $attachments as $id => $attachment ) {
$link = isset($attr['link']) && 'file' == $attr['link'] ? wp_get_attachment_link($id, $size, false, false) : wp_get_attachment_link($id, $size, true, false);
$image_meta = wp_get_attachment_metadata( $id );
$orientation = ( $image_meta['height'] > $image_meta['width'] ) ? 'portrait' : 'landscape';
$output .= "<{$itemtag} class='gallery-item'>";
$output .= "
<{$icontag} class='gallery-icon'>
<{$icontag} class='gallery-icon {$orientation}'>
$link
</{$icontag}>";
if ( $captiontag && trim($attachment->post_excerpt) ) {