Skip to content
This repository
Newer
Older
100644 111 lines (94 sloc) 5.286 kb
edfeccc2 »
2012-01-07 _s: initial fork of Toolbox
1 <?php
2 /**
3 * The template for displaying image attachments.
4 *
5 * @package _s
6 * @since _s 1.0
7 */
8
293458cb »
2012-02-02 _s: First pass at keyboard navigation in image templates
9 get_header();
10 ?>
edfeccc2 »
2012-01-07 _s: initial fork of Toolbox
11
752d08af »
2012-08-25 Update the HTML "class" system
12 <div id="primary" class="content-area image-attachment">
13 <div id="content" class="site-content" role="main">
edfeccc2 »
2012-01-07 _s: initial fork of Toolbox
14
15 <?php while ( have_posts() ) : the_post(); ?>
16
17 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
18 <header class="entry-header">
19 <h1 class="entry-title"><?php the_title(); ?></h1>
20
21 <div class="entry-meta">
22 <?php
23 $metadata = wp_get_attachment_metadata();
2428d6a0 »
2012-02-02 _s: using the time element image attachments to match posts
24 printf( __( 'Published <span class="entry-date"><time class="entry-date" datetime="%1$s" pubdate>%2$s</time></span> at <a href="%3$s" title="Link to full-size image">%4$s &times; %5$s</a> in <a href="%6$s" title="Return to %7$s" rel="gallery">%7$s</a>', '_s' ),
25 esc_attr( get_the_date( 'c' ) ),
26 esc_html( get_the_date() ),
edfeccc2 »
2012-01-07 _s: initial fork of Toolbox
27 wp_get_attachment_url(),
28 $metadata['width'],
29 $metadata['height'],
30 get_permalink( $post->post_parent ),
31 get_the_title( $post->post_parent )
32 );
33 ?>
c71f030c »
2012-03-06 _s: Move post meta separators inside conditionals ensuring that separ…
34 <?php edit_post_link( __( 'Edit', '_s' ), '<span class="sep"> | </span> <span class="edit-link">', '</span>' ); ?>
edfeccc2 »
2012-01-07 _s: initial fork of Toolbox
35 </div><!-- .entry-meta -->
36
3833150b »
2012-09-04 _s: Add 'site-navigation' class to image.php's image navigation conta…
37 <nav id="image-navigation" class="site-navigation">
93a334bc »
2012-02-21 _s: refix footer URL and extra spaces, originally fixed in r8766 but …
38 <span class="previous-image"><?php previous_image_link( false, __( '&larr; Previous', '_s' ) ); ?></span>
39 <span class="next-image"><?php next_image_link( false, __( 'Next &rarr;', '_s' ) ); ?></span>
edfeccc2 »
2012-01-07 _s: initial fork of Toolbox
40 </nav><!-- #image-navigation -->
41 </header><!-- .entry-header -->
42
43 <div class="entry-content">
44
45 <div class="entry-attachment">
46 <div class="attachment">
47 <?php
48 /**
49 * 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,
50 * 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
51 */
52 $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' ) ) );
53 foreach ( $attachments as $k => $attachment ) {
54 if ( $attachment->ID == $post->ID )
55 break;
56 }
57 $k++;
58 // If there is more than 1 attachment in a gallery
59 if ( count( $attachments ) > 1 ) {
60 if ( isset( $attachments[ $k ] ) )
61 // get the URL of the next image attachment
62 $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
63 else
64 // or get the URL of the first image attachment
65 $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
66 } else {
67 // or, if there's only 1 image, get the URL of the image
68 $next_attachment_url = wp_get_attachment_url();
69 }
70 ?>
71
72 <a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
bd4719e7 »
2012-04-23 _s: Better image filtering for self-hosted users. fixes #1216
73 $attachment_size = apply_filters( '_s_attachment_size', array( 1200, 1200 ) ); // Filterable image size.
74 echo wp_get_attachment_image( $post->ID, $attachment_size );
edfeccc2 »
2012-01-07 _s: initial fork of Toolbox
75 ?></a>
76 </div><!-- .attachment -->
77
78 <?php if ( ! empty( $post->post_excerpt ) ) : ?>
79 <div class="entry-caption">
80 <?php the_excerpt(); ?>
b9fa5c0d »
2012-05-23 Add missing 'class' comments
81 </div><!-- .entry-caption -->
edfeccc2 »
2012-01-07 _s: initial fork of Toolbox
82 <?php endif; ?>
83 </div><!-- .entry-attachment -->
84
85 <?php the_content(); ?>
a81dc6a8 »
2012-01-13 _s: Adding starter styles along with a few markup changes to accomoda…
86 <?php wp_link_pages( array( 'before' => '<div class="page-links">' . __( 'Pages:', '_s' ), 'after' => '</div>' ) ); ?>
edfeccc2 »
2012-01-07 _s: initial fork of Toolbox
87
88 </div><!-- .entry-content -->
89
90 <footer class="entry-meta">
91 <?php if ( comments_open() && pings_open() ) : // Comments and trackbacks open ?>
92 <?php printf( __( '<a class="comment-link" href="#respond" title="Post a comment">Post a comment</a> or leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', '_s' ), get_trackback_url() ); ?>
93 <?php elseif ( ! comments_open() && pings_open() ) : // Only trackbacks open ?>
94 <?php printf( __( 'Comments are closed, but you can leave a trackback: <a class="trackback-link" href="%s" title="Trackback URL for your post" rel="trackback">Trackback URL</a>.', '_s' ), get_trackback_url() ); ?>
95 <?php elseif ( comments_open() && ! pings_open() ) : // Only comments open ?>
96 <?php _e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', '_s' ); ?>
97 <?php elseif ( ! comments_open() && ! pings_open() ) : // Comments and trackbacks closed ?>
98 <?php _e( 'Both comments and trackbacks are currently closed.', '_s' ); ?>
99 <?php endif; ?>
100 <?php edit_post_link( __( 'Edit', '_s' ), ' <span class="edit-link">', '</span>' ); ?>
101 </footer><!-- .entry-meta -->
102 </article><!-- #post-<?php the_ID(); ?> -->
103
104 <?php comments_template(); ?>
105
106 <?php endwhile; // end of the loop. ?>
107
752d08af »
2012-08-25 Update the HTML "class" system
108 </div><!-- #content .site-content -->
109 </div><!-- #primary .content-area .image-attachment -->
edfeccc2 »
2012-01-07 _s: initial fork of Toolbox
110
111 <?php get_footer(); ?>
Something went wrong with that request. Please try again.