3 * The template for displaying attachments.
6 * @subpackage Twenty_Ten
7 * @since Twenty Ten 1.0
12 <div id="container" class="single-attachment">
13 <div id="content" role="main">
15 <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
17 <?php if ( ! empty( $post->post_parent ) ) : ?>
18 <p class="page-title"><a href="<?php echo get_permalink( $post->post_parent ); ?>" title="<?php esc_attr( printf( __( 'Return to %s', 'twentyten' ), get_the_title( $post->post_parent ) ) ); ?>" rel="gallery"><?php
19 /* translators: %s - title of parent post */
20 printf( __( '<span class="meta-nav">←</span> %s', 'twentyten' ), get_the_title( $post->post_parent ) );
24 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
25 <h2 class="entry-title"><?php the_title(); ?></h2>
27 <div class="entry-meta">
29 printf(__('<span class="%1$s">By</span> %2$s', 'twentyten'),
30 'meta-prep meta-prep-author',
31 sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
32 get_author_posts_url( get_the_author_meta( 'ID' ) ),
33 sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
38 <span class="meta-sep">|</span>
40 printf( __('<span class="%1$s">Published</span> %2$s', 'twentyten'),
41 'meta-prep meta-prep-entry-date',
42 sprintf( '<span class="entry-date"><abbr class="published" title="%1$s">%2$s</abbr></span>',
43 esc_attr( get_the_time() ),
47 if ( wp_attachment_is_image() ) {
48 echo ' <span class="meta-sep">|</span> ';
49 $metadata = wp_get_attachment_metadata();
50 printf( __( 'Full size is %s pixels', 'twentyten'),
51 sprintf( '<a href="%1$s" title="%2$s">%3$s × %4$s</a>',
52 wp_get_attachment_url(),
53 esc_attr( __('Link to full-size image', 'twentyten') ),
60 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?>
61 </div><!-- .entry-meta -->
63 <div class="entry-content">
64 <div class="entry-attachment">
65 <?php if ( wp_attachment_is_image() ) :
66 $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' ) ) );
67 foreach ( $attachments as $k => $attachment ) {
68 if ( $attachment->ID == $post->ID )
72 // If there is more than 1 image attachment in a gallery
73 if ( count( $attachments ) > 1 ) {
74 if ( isset( $attachments[ $k ] ) )
75 // get the URL of the next image attachment
76 $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID );
78 // or get the URL of the first image attachment
79 $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID );
81 // or, if there's only 1 image attachment, get the URL of the image
82 $next_attachment_url = wp_get_attachment_url();
85 <p class="attachment"><a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php
86 $attachment_size = apply_filters( 'twentyten_attachment_size', 900 );
87 echo wp_get_attachment_image( $post->ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height.
90 <div id="nav-below" class="navigation">
91 <div class="nav-previous"><?php previous_image_link( false ); ?></div>
92 <div class="nav-next"><?php next_image_link( false ); ?></div>
93 </div><!-- #nav-below -->
95 <a href="<?php echo wp_get_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php echo basename( get_permalink() ); ?></a>
97 </div><!-- .entry-attachment -->
98 <div class="entry-caption"><?php if ( !empty( $post->post_excerpt ) ) the_excerpt(); ?></div>
100 <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?>
101 <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
103 </div><!-- .entry-content -->
105 <div class="entry-utility">
106 <?php twentyten_posted_in(); ?>
107 <?php edit_post_link( __( 'Edit', 'twentyten' ), ' <span class="edit-link">', '</span>' ); ?>
108 </div><!-- .entry-utility -->
109 </div><!-- #post-## -->
111 <?php comments_template(); ?>
115 </div><!-- #content -->
116 </div><!-- #container -->
118 <?php get_footer(); ?>