Changeset 25021 for trunk/src/wp-content/themes/twentyfourteen/image.php
- Timestamp:
- 08/14/2013 04:38:01 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-content/themes/twentyfourteen/image.php
r24832 r25021 10 10 ?> 11 11 12 < divid="primary" class="content-area image-attachment">12 <section id="primary" class="content-area image-attachment"> 13 13 <div id="content" class="site-content full-width" role="main"> 14 14 … … 17 17 <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> 18 18 <header class="entry-header"> 19 < h1 class="entry-title"><?php the_title(); ?></h1>19 <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> 20 20 21 21 <div class="entry-meta"> … … 32 32 33 33 <div class="entry-content"> 34 35 34 <div class="entry-attachment"> 36 35 <div class="attachment"> 37 <?php 38 /** 39 * 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, 40 * 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 41 */ 42 $attachments = array_values( get_children( array( 43 'post_parent' => $post->post_parent, 44 'post_status' => 'inherit', 45 'post_type' => 'attachment', 46 'post_mime_type' => 'image', 47 'order' => 'ASC', 48 'orderby' => 'menu_order ID' 49 ) ) ); 50 foreach ( $attachments as $k => $attachment ) { 51 if ( $attachment->ID == $post->ID ) 52 break; 53 } 54 $k++; 55 // If there is more than 1 attachment in a gallery 56 if ( count( $attachments ) > 1 ) { 57 if ( isset( $attachments[ $k ] ) ) 58 // get the URL of the next image attachment 59 $next_attachment_url = get_attachment_link( $attachments[ $k ]->ID ); 60 else 61 // or get the URL of the first image attachment 62 $next_attachment_url = get_attachment_link( $attachments[ 0 ]->ID ); 63 } else { 64 // or, if there's only 1 image, get the URL of the image 65 $next_attachment_url = wp_get_attachment_url(); 66 } 67 ?> 68 69 <a href="<?php echo $next_attachment_url; ?>" title="<?php echo esc_attr( get_the_title() ); ?>" rel="attachment"><?php 70 $attachment_size = apply_filters( 'twentyfourteen_attachment_size', array( 1200, 1200 ) ); // Filterable image size. 71 echo wp_get_attachment_image( $post->ID, $attachment_size ); 72 ?></a> 36 <?php twentyfourteen_the_attached_image(); ?> 73 37 </div><!-- .attachment --> 74 38 75 <?php if ( ! empty( $post->post_excerpt) ) : ?>39 <?php if ( has_excerpt() ) : ?> 76 40 <div class="entry-caption"> 77 41 <?php the_excerpt(); ?> … … 80 44 </div><!-- .entry-attachment --> 81 45 82 <?php the_content(); ?>83 46 <?php 47 the_content(); 84 48 wp_link_pages( array( 85 49 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>', 86 50 'after' => '</div>', 87 51 'link_before' => '<span>', 88 'link_after' => '</span>' 52 'link_after' => '</span>', 89 53 ) ); 90 54 ?> … … 92 56 93 57 <footer class="entry-meta"> 94 <?php if ( comments_open() && pings_open() ) : // Comments and trackbacks open ?> 95 <?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>.', 'twentyfourteen' ), get_trackback_url() ); ?> 96 <?php elseif ( ! comments_open() && pings_open() ) : // Only trackbacks open ?> 97 <?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>.', 'twentyfourteen' ), get_trackback_url() ); ?> 98 <?php elseif ( comments_open() && ! pings_open() ) : // Only comments open ?> 99 <?php _e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', 'twentyfourteen' ); ?> 100 <?php elseif ( ! comments_open() && ! pings_open() ) : // Comments and trackbacks closed ?> 101 <?php _e( 'Both comments and trackbacks are currently closed.', 'twentyfourteen' ); ?> 102 <?php endif; ?> 58 <?php 59 if ( comments_open() && pings_open() ) : // Comments and trackbacks open 60 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>.', 'twentyfourteen' ), get_trackback_url() ); 61 elseif ( ! comments_open() && pings_open() ) : // Only trackbacks open 62 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>.', 'twentyfourteen' ), get_trackback_url() ); 63 elseif ( comments_open() && ! pings_open() ) : // Only comments open 64 _e( 'Trackbacks are closed, but you can <a class="comment-link" href="#respond" title="Post a comment">post a comment</a>.', 'twentyfourteen' ); 65 elseif ( ! comments_open() && ! pings_open() ) : // Comments and trackbacks closed 66 _e( 'Both comments and trackbacks are currently closed.', 'twentyfourteen' ); 67 endif; 68 ?> 103 69 </footer><!-- .entry-meta --> 104 </article><!-- #post- <?php the_ID(); ?>-->70 </article><!-- #post-## --> 105 71 106 72 <nav id="image-navigation" class="site-navigation"> … … 113 79 <?php endwhile; // end of the loop. ?> 114 80 115 </div><!-- #content .site-content-->116 </ div><!-- #primary .content-area .image-attachment-->81 </div><!-- #content --> 82 </section><!-- #primary --> 117 83 118 <?php get_sidebar(); ?>119 120 <?php get_footer(); ?> 84 <?php 85 get_sidebar(); 86 get_footer();
Note: See TracChangeset
for help on using the changeset viewer.