wp/wp-content/themes/twentytwelve/image.php
changeset 5 5e2f62d02dcd
parent 0 d970ebf37754
child 7 cf61fcea0001
--- a/wp/wp-content/themes/twentytwelve/image.php	Mon Jun 08 16:11:51 2015 +0000
+++ b/wp/wp-content/themes/twentytwelve/image.php	Tue Jun 09 03:35:32 2015 +0200
@@ -2,7 +2,7 @@
 /**
  * The template for displaying image attachments
  *
- * @link http://codex.wordpress.org/Template_Hierarchy
+ * @link https://codex.wordpress.org/Template_Hierarchy
  *
  * @package WordPress
  * @subpackage Twenty_Twelve
@@ -58,15 +58,15 @@
 		break;
 endforeach;
 
-$k++;
 // If there is more than 1 attachment in a gallery
 if ( count( $attachments ) > 1 ) :
+	$k++;
 	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 );
+		$next_attachment_url = get_attachment_link( $attachments[0]->ID );
 	endif;
 else :
 	// or, if there's only 1 image, get the URL of the image
@@ -113,4 +113,4 @@
 		</div><!-- #content -->
 	</div><!-- #primary -->
 
-<?php get_footer(); ?>
\ No newline at end of file
+<?php get_footer(); ?>