wp/wp-content/themes/twentyfifteen/image.php
changeset 8 c7c34916027a
parent 7 cf61fcea0001
child 9 177826044cd9
equal deleted inserted replaced
7:cf61fcea0001 8:c7c34916027a
     1 <?php
       
     2 /**
       
     3  * The template for displaying image attachments
       
     4  *
       
     5  * @package WordPress
       
     6  * @subpackage Twenty_Fifteen
       
     7  * @since Twenty Fifteen 1.0
       
     8  */
       
     9 
       
    10 get_header(); ?>
       
    11 
       
    12 	<div id="primary" class="content-area">
       
    13 		<main id="main" class="site-main" role="main">
       
    14 
       
    15 			<?php
       
    16 				// Start the loop.
       
    17 				while ( have_posts() ) : the_post();
       
    18 			?>
       
    19 
       
    20 				<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
       
    21 
       
    22 					<nav id="image-navigation" class="navigation image-navigation">
       
    23 						<div class="nav-links">
       
    24 							<div class="nav-previous"><?php previous_image_link( false, __( 'Previous Image', 'twentyfifteen' ) ); ?></div><div class="nav-next"><?php next_image_link( false, __( 'Next Image', 'twentyfifteen' ) ); ?></div>
       
    25 						</div><!-- .nav-links -->
       
    26 					</nav><!-- .image-navigation -->
       
    27 
       
    28 					<header class="entry-header">
       
    29 						<?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
       
    30 					</header><!-- .entry-header -->
       
    31 
       
    32 					<div class="entry-content">
       
    33 
       
    34 						<div class="entry-attachment">
       
    35 							<?php
       
    36 								/**
       
    37 								 * Filter the default Twenty Fifteen image attachment size.
       
    38 								 *
       
    39 								 * @since Twenty Fifteen 1.0
       
    40 								 *
       
    41 								 * @param string $image_size Image size. Default 'large'.
       
    42 								 */
       
    43 								$image_size = apply_filters( 'twentyfifteen_attachment_size', 'large' );
       
    44 
       
    45 								echo wp_get_attachment_image( get_the_ID(), $image_size );
       
    46 							?>
       
    47 
       
    48 							<?php if ( has_excerpt() ) : ?>
       
    49 								<div class="entry-caption">
       
    50 									<?php the_excerpt(); ?>
       
    51 								</div><!-- .entry-caption -->
       
    52 							<?php endif; ?>
       
    53 
       
    54 						</div><!-- .entry-attachment -->
       
    55 
       
    56 						<?php
       
    57 							the_content();
       
    58 							wp_link_pages( array(
       
    59 								'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
       
    60 								'after'       => '</div>',
       
    61 								'link_before' => '<span>',
       
    62 								'link_after'  => '</span>',
       
    63 								'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
       
    64 								'separator'   => '<span class="screen-reader-text">, </span>',
       
    65 							) );
       
    66 						?>
       
    67 					</div><!-- .entry-content -->
       
    68 
       
    69 					<footer class="entry-footer">
       
    70 						<?php twentyfifteen_entry_meta(); ?>
       
    71 						<?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?>
       
    72 					</footer><!-- .entry-footer -->
       
    73 
       
    74 				</article><!-- #post-## -->
       
    75 
       
    76 				<?php
       
    77 					// If comments are open or we have at least one comment, load up the comment template
       
    78 					if ( comments_open() || get_comments_number() ) :
       
    79 						comments_template();
       
    80 					endif;
       
    81 
       
    82 					// Previous/next post navigation.
       
    83 					the_post_navigation( array(
       
    84 						'prev_text' => _x( '<span class="meta-nav">Published in</span><span class="post-title">%title</span>', 'Parent post link', 'twentyfifteen' ),
       
    85 					) );
       
    86 
       
    87 				// End the loop.
       
    88 				endwhile;
       
    89 			?>
       
    90 
       
    91 		</main><!-- .site-main -->
       
    92 	</div><!-- .content-area -->
       
    93 
       
    94 <?php get_footer(); ?>