| [ Root ] [ Search ] [ Index ] |
PHP Cross Reference of WordPress 3.0Provided by Yoast |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * The template for displaying attachments. 4 * 5 * @package WordPress 6 * @subpackage Twenty_Ten 7 * @since Twenty Ten 1.0 8 */ 9 10 get_header(); ?> 11 12 <div id="container"> 13 <div id="content" role="main"> 14 15 <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> 16 17 <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 18 /* translators: %s - title of parent post */ 19 printf( __( '<span class="meta-nav">←</span> %s', 'twentyten' ), get_the_title( $post->post_parent ) ); 20 ?></a></p> 21 22 <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 23 <h2 class="entry-title"><?php the_title(); ?></h2> 24 25 <div class="entry-meta"> 26 <?php 27 printf(__('<span class="%1$s">By</span> %2$s', 'twentyten'), 28 'meta-prep meta-prep-author', 29 sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>', 30 get_author_posts_url( get_the_author_meta( 'ID' ) ), 31 sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ), 32 get_the_author() 33 ) 34 ); 35 ?> 36 <span class="meta-sep">|</span> 37 <?php 38 printf( __('<span class="%1$s">Published</span> %2$s', 'twentyten'), 39 'meta-prep meta-prep-entry-date', 40 sprintf( '<span class="entry-date"><abbr class="published" title="%1$s">%2$s</abbr></span>', 41 esc_attr( get_the_time() ), 42 get_the_date() 43 ) 44 ); 45 if ( wp_attachment_is_image() ) { 46 echo ' <span class="meta-sep">|</span> '; 47 $metadata = wp_get_attachment_metadata(); 48 printf( __( 'Full size is %s pixels', 'twentyten'), 49 sprintf( '<a href="%1$s" title="%2$s">%3$s × %4$s</a>', 50 wp_get_attachment_url(), 51 esc_attr( __('Link to full-size image', 'twentyten') ), 52 $metadata['width'], 53 $metadata['height'] 54 ) 55 ); 56 } 57 ?> 58 <?php edit_post_link( __( 'Edit', 'twentyten' ), '<span class="meta-sep">|</span> <span class="edit-link">', '</span>' ); ?> 59 </div><!-- .entry-meta --> 60 61 <div class="entry-content"> 62 <div class="entry-attachment"> 63 <?php if ( wp_attachment_is_image() ) : 64 $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' ) ) ); 65 foreach ( $attachments as $k => $attachment ) { 66 if ( $attachment->ID == $post->ID ) 67 break; 68 } 69 $k++; 70 // If there is more than 1 image attachment in a gallery 71 if ( count( $attachments ) > 1 ) { 72 if ( isset( $attachments[ $k ] ) ) 73 // get the URL of the next image attachment 74 $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); 75 else 76 // or get the URL of the first image attachment 77 $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID ); 78 } else { 79 // or, if there's only 1 image attachment, get the URL of the image 80 $next_attachment_url = wp_get_attachment_url(); 81 } 82 ?> 83 <p class="attachment"><a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php 84 $attachment_size = apply_filters( 'twentyten_attachment_size', 900 ); 85 echo wp_get_attachment_image( $post->ID, array( $attachment_size, 9999 ) ); // filterable image width with, essentially, no limit for image height. 86 ?></a></p> 87 88 <div id="nav-below" class="navigation"> 89 <div class="nav-previous"><?php previous_image_link( false ); ?></div> 90 <div class="nav-next"><?php next_image_link( false ); ?></div> 91 </div><!-- #nav-below --> 92 <?php else : ?> 93 <a href="<?php echo wp_get_attachment_url(); ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php echo basename( get_permalink() ); ?></a> 94 <?php endif; ?> 95 </div><!-- .entry-attachment --> 96 <div class="entry-caption"><?php if ( !empty( $post->post_excerpt ) ) the_excerpt(); ?></div> 97 98 <?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?> 99 <?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?> 100 101 </div><!-- .entry-content --> 102 103 <div class="entry-utility"> 104 <?php twentyten_posted_in(); ?> 105 <?php edit_post_link( __( 'Edit', 'twentyten' ), ' <span class="edit-link">', '</span>' ); ?> 106 </div><!-- .entry-utility --> 107 </div><!-- #post-## --> 108 109 <?php comments_template(); ?> 110 111 <?php endwhile; ?> 112 113 </div><!-- #content --> 114 </div><!-- #container --> 115 116 <?php get_footer(); ?>
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Thu Oct 14 05:11:12 2010 | Cross-referenced by PHPXref 0.7 |