mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 17:48:01 +01:00
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:
parent
003ede0b13
commit
e31cc08860
@ -68,10 +68,18 @@
|
||||
break;
|
||||
}
|
||||
$k++;
|
||||
// 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
|
||||
$next_attachment_url = get_permalink( $post->post_parent );
|
||||
// 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 );
|
||||
|
Loading…
Reference in New Issue
Block a user