Add orientation information to gallery items. props obenland. fixes #23695.
git-svn-id: http://core.svn.wordpress.org/trunk@23649 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
c4963814d3
commit
2e4d128fe0
|
@ -778,10 +778,12 @@ function gallery_shortcode($attr) {
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ( $attachments as $id => $attachment ) {
|
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);
|
$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 .= "<{$itemtag} class='gallery-item'>";
|
||||||
$output .= "
|
$output .= "
|
||||||
<{$icontag} class='gallery-icon'>
|
<{$icontag} class='gallery-icon {$orientation}'>
|
||||||
$link
|
$link
|
||||||
</{$icontag}>";
|
</{$icontag}>";
|
||||||
if ( $captiontag && trim($attachment->post_excerpt) ) {
|
if ( $captiontag && trim($attachment->post_excerpt) ) {
|
||||||
|
|
Loading…
Reference in New Issue