In Twenty ten, make last gallery image link back to the first. Props iandstewart.

git-svn-id: http://svn.automattic.com/wordpress/trunk@15208 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
iammattthomas 2010-06-11 02:01:56 +00:00
parent 003ede0b13
commit e31cc08860
1 changed files with 12 additions and 4 deletions

View File

@ -68,10 +68,18 @@
break;
}
$k++;
if ( isset( $attachments[ $k ] ) )
$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
else
$next_attachment_url = get_permalink( $post->post_parent );
// If there is more than 1 image attachment in a gallery
if ( count( $attachments ) > 1 ) {
if ( isset( $attachments[ $k ] ) )
// get the URL of the next image attachment
$next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
else
// or get the URL of the first image attachment
$next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
} else {
// or, if there's only 1 image attachment, get the URL of the image
$next_attachment_url = wp_get_attachment_url();
}
?>
<p class="attachment"><a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
$attachment_size = apply_filters( 'twentyten_attachment_size', 900 );