12 get_header(); ?> |
12 get_header(); ?> |
13 |
13 |
14 <div id="primary" class="site-content"> |
14 <div id="primary" class="site-content"> |
15 <div id="content" role="main"> |
15 <div id="content" role="main"> |
16 |
16 |
17 <?php while ( have_posts() ) : the_post(); ?> |
17 <?php |
|
18 while ( have_posts() ) : |
|
19 the_post(); |
|
20 ?> |
18 |
21 |
19 <article id="post-<?php the_ID(); ?>" <?php post_class( 'image-attachment' ); ?>> |
22 <article id="post-<?php the_ID(); ?>" <?php post_class( 'image-attachment' ); ?>> |
20 <header class="entry-header"> |
23 <header class="entry-header"> |
21 <h1 class="entry-title"><?php the_title(); ?></h1> |
24 <h1 class="entry-title"><?php the_title(); ?></h1> |
22 |
25 |
23 <footer class="entry-meta"> |
26 <footer class="entry-meta"> |
24 <?php |
27 <?php |
25 $metadata = wp_get_attachment_metadata(); |
28 $metadata = wp_get_attachment_metadata(); |
26 printf( __( '<span class="meta-prep meta-prep-entry-date">Published </span> <span class="entry-date"><time class="entry-date" datetime="%1$s">%2$s</time></span> at <a href="%3$s" title="Link to full-size image">%4$s × %5$s</a> in <a href="%6$s" title="Return to %7$s" rel="gallery">%8$s</a>.', 'twentytwelve' ), |
29 printf( |
|
30 __( '<span class="meta-prep meta-prep-entry-date">Published </span> <span class="entry-date"><time class="entry-date" datetime="%1$s">%2$s</time></span> at <a href="%3$s" title="Link to full-size image">%4$s × %5$s</a> in <a href="%6$s" title="Return to %7$s" rel="gallery">%8$s</a>.', 'twentytwelve' ), |
27 esc_attr( get_the_date( 'c' ) ), |
31 esc_attr( get_the_date( 'c' ) ), |
28 esc_html( get_the_date() ), |
32 esc_html( get_the_date() ), |
29 esc_url( wp_get_attachment_url() ), |
33 esc_url( wp_get_attachment_url() ), |
30 $metadata['width'], |
34 $metadata['width'], |
31 $metadata['height'], |
35 $metadata['height'], |
50 <?php |
54 <?php |
51 /* |
55 /* |
52 * 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, |
56 * 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, |
53 * 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 |
57 * 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 |
54 */ |
58 */ |
55 $attachments = array_values( get_children( array( 'post_parent' => $post->post_parent, 'post_status' => 'inherit', 'post_type' => 'attachment', 'post_mime_type' => 'image', 'order' => 'ASC', 'orderby' => 'menu_order ID' ) ) ); |
59 $attachments = array_values( |
|
60 get_children( |
|
61 array( |
|
62 'post_parent' => $post->post_parent, |
|
63 'post_status' => 'inherit', |
|
64 'post_type' => 'attachment', |
|
65 'post_mime_type' => 'image', |
|
66 'order' => 'ASC', |
|
67 'orderby' => 'menu_order ID', |
|
68 ) |
|
69 ) |
|
70 ); |
56 foreach ( $attachments as $k => $attachment ) : |
71 foreach ( $attachments as $k => $attachment ) : |
57 if ( $attachment->ID == $post->ID ) |
72 if ( $attachment->ID == $post->ID ) { |
58 break; |
73 break; |
|
74 } |
59 endforeach; |
75 endforeach; |
60 |
76 |
61 // If there is more than 1 attachment in a gallery |
77 // If there is more than 1 attachment in a gallery |
62 if ( count( $attachments ) > 1 ) : |
78 if ( count( $attachments ) > 1 ) : |
63 $k++; |
79 $k++; |
71 else : |
87 else : |
72 // or, if there's only 1 image, get the URL of the image |
88 // or, if there's only 1 image, get the URL of the image |
73 $next_attachment_url = wp_get_attachment_url(); |
89 $next_attachment_url = wp_get_attachment_url(); |
74 endif; |
90 endif; |
75 ?> |
91 ?> |
76 <a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"><?php |
92 <a href="<?php echo esc_url( $next_attachment_url ); ?>" title="<?php the_title_attribute(); ?>" rel="attachment"> |
77 /** |
93 <?php |
78 * Filter the image attachment size to use. |
94 /** |
79 * |
95 * Filter the image attachment size to use. |
80 * @since Twenty Twelve 1.0 |
96 * |
81 * |
97 * @since Twenty Twelve 1.0 |
82 * @param array $size { |
98 * |
83 * @type int The attachment height in pixels. |
99 * @param array $size { |
84 * @type int The attachment width in pixels. |
100 * @type int The attachment height in pixels. |
85 * } |
101 * @type int The attachment width in pixels. |
86 */ |
102 * } |
87 $attachment_size = apply_filters( 'twentytwelve_attachment_size', array( 960, 960 ) ); |
103 */ |
88 echo wp_get_attachment_image( $post->ID, $attachment_size ); |
104 $attachment_size = apply_filters( 'twentytwelve_attachment_size', array( 960, 960 ) ); |
89 ?></a> |
105 echo wp_get_attachment_image( $post->ID, $attachment_size ); |
|
106 ?> |
|
107 </a> |
90 |
108 |
91 <?php if ( ! empty( $post->post_excerpt ) ) : ?> |
109 <?php if ( ! empty( $post->post_excerpt ) ) : ?> |
92 <div class="entry-caption"> |
110 <div class="entry-caption"> |
93 <?php the_excerpt(); ?> |
111 <?php the_excerpt(); ?> |
94 </div> |
112 </div> |
97 |
115 |
98 </div><!-- .entry-attachment --> |
116 </div><!-- .entry-attachment --> |
99 |
117 |
100 <div class="entry-description"> |
118 <div class="entry-description"> |
101 <?php the_content(); ?> |
119 <?php the_content(); ?> |
102 <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), 'after' => '</div>' ) ); ?> |
120 <?php |
|
121 wp_link_pages( |
|
122 array( |
|
123 'before' => '<div class="page-links">' . __( 'Pages:', 'twentytwelve' ), |
|
124 'after' => '</div>', |
|
125 ) |
|
126 ); |
|
127 ?> |
103 </div><!-- .entry-description --> |
128 </div><!-- .entry-description --> |
104 |
129 |
105 </div><!-- .entry-content --> |
130 </div><!-- .entry-content --> |
106 |
131 |
107 </article><!-- #post --> |
132 </article><!-- #post --> |