]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-content/themes/twentytwelve/image.php
WordPress 4.0
[autoinstalls/wordpress.git] / wp-content / themes / twentytwelve / image.php
index b2fcb428ac5ce8d8253e86041f4103541102e0bc..1dc2aa931294a18a5fc2711087a08ae83f17c22f 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 /**
- * The template for displaying image attachments.
+ * The template for displaying image attachments
  *
- * Learn more: http://codex.wordpress.org/Template_Hierarchy
+ * @link http://codex.wordpress.org/Template_Hierarchy
  *
  * @package WordPress
  * @subpackage Twenty_Twelve
@@ -48,7 +48,7 @@ get_header(); ?>
                                                <div class="entry-attachment">
                                                        <div class="attachment">
 <?php
-/**
+/*
  * Grab the IDs of all the image attachments in a gallery so we can get the URL of the next adjacent image in a gallery,
  * or the first image (if we're looking at the last image in a gallery), or, in a gallery of one, just the link to that image file
  */
@@ -58,9 +58,9 @@ foreach ( $attachments as $k => $attachment ) :
                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 );
@@ -74,6 +74,16 @@ else :
 endif;
 ?>
                                                                <a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php
+                                                               /**
+                                                                * Filter the image attachment size to use.
+                                                                *
+                                                                * @since Twenty Twelve 1.0
+                                                                *
+                                                                * @param array $size {
+                                                                *     @type int The attachment height in pixels.
+                                                                *     @type int The attachment width in pixels.
+                                                                * }
+                                                                */
                                                                $attachment_size = apply_filters( 'twentytwelve_attachment_size', array( 960, 960 ) );
                                                                echo wp_get_attachment_image( $post->ID, $attachment_size );
                                                                ?></a>