wp/wp-content/themes/twentyfourteen/image.php
changeset 5 5e2f62d02dcd
child 7 cf61fcea0001
equal deleted inserted replaced
4:346c88efed21 5:5e2f62d02dcd
       
     1 <?php
       
     2 /**
       
     3  * The template for displaying image attachments
       
     4  *
       
     5  * @package WordPress
       
     6  * @subpackage Twenty_Fourteen
       
     7  * @since Twenty Fourteen 1.0
       
     8  */
       
     9 
       
    10 // Retrieve attachment metadata.
       
    11 $metadata = wp_get_attachment_metadata();
       
    12 
       
    13 get_header();
       
    14 ?>
       
    15 
       
    16 	<section id="primary" class="content-area image-attachment">
       
    17 		<div id="content" class="site-content" role="main">
       
    18 
       
    19 	<?php
       
    20 		// Start the Loop.
       
    21 		while ( have_posts() ) : the_post();
       
    22 	?>
       
    23 			<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
       
    24 				<header class="entry-header">
       
    25 					<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
       
    26 
       
    27 					<div class="entry-meta">
       
    28 
       
    29 						<span class="entry-date"><time class="entry-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time></span>
       
    30 
       
    31 						<span class="full-size-link"><a href="<?php echo esc_url( wp_get_attachment_url() ); ?>"><?php echo esc_html( $metadata['width'] ); ?> &times; <?php echo esc_html( $metadata['height'] ); ?></a></span>
       
    32 
       
    33 						<span class="parent-post-link"><a href="<?php echo esc_url( get_permalink( $post->post_parent ) ); ?>" rel="gallery"><?php echo get_the_title( $post->post_parent ); ?></a></span>
       
    34 						<?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
       
    35 					</div><!-- .entry-meta -->
       
    36 				</header><!-- .entry-header -->
       
    37 
       
    38 				<div class="entry-content">
       
    39 					<div class="entry-attachment">
       
    40 						<div class="attachment">
       
    41 							<?php twentyfourteen_the_attached_image(); ?>
       
    42 						</div><!-- .attachment -->
       
    43 
       
    44 						<?php if ( has_excerpt() ) : ?>
       
    45 						<div class="entry-caption">
       
    46 							<?php the_excerpt(); ?>
       
    47 						</div><!-- .entry-caption -->
       
    48 						<?php endif; ?>
       
    49 					</div><!-- .entry-attachment -->
       
    50 
       
    51 					<?php
       
    52 						the_content();
       
    53 						wp_link_pages( array(
       
    54 							'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
       
    55 							'after'       => '</div>',
       
    56 							'link_before' => '<span>',
       
    57 							'link_after'  => '</span>',
       
    58 						) );
       
    59 					?>
       
    60 				</div><!-- .entry-content -->
       
    61 			</article><!-- #post-## -->
       
    62 
       
    63 			<nav id="image-navigation" class="navigation image-navigation">
       
    64 				<div class="nav-links">
       
    65 				<?php previous_image_link( false, '<div class="previous-image">' . __( 'Previous Image', 'twentyfourteen' ) . '</div>' ); ?>
       
    66 				<?php next_image_link( false, '<div class="next-image">' . __( 'Next Image', 'twentyfourteen' ) . '</div>' ); ?>
       
    67 				</div><!-- .nav-links -->
       
    68 			</nav><!-- #image-navigation -->
       
    69 
       
    70 			<?php comments_template(); ?>
       
    71 
       
    72 		<?php endwhile; // end of the loop. ?>
       
    73 
       
    74 		</div><!-- #content -->
       
    75 	</section><!-- #primary -->
       
    76 
       
    77 <?php
       
    78 get_sidebar();
       
    79 get_footer();