WordPress 4.7.2-scripts
[autoinstalls/wordpress.git] / wp-content / themes / twentysixteen / image.php
1 <?php
2 /**
3  * The template for displaying image attachments
4  *
5  * @package WordPress
6  * @subpackage Twenty_Sixteen
7  * @since Twenty Sixteen 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', 'twentysixteen' ) ); ?></div>
25                                                         <div class="nav-next"><?php next_image_link( false, __( 'Next Image', 'twentysixteen' ) ); ?></div>
26                                                 </div><!-- .nav-links -->
27                                         </nav><!-- .image-navigation -->
28
29                                         <header class="entry-header">
30                                                 <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
31                                         </header><!-- .entry-header -->
32
33                                         <div class="entry-content">
34
35                                                 <div class="entry-attachment">
36                                                         <?php
37                                                                 /**
38                                                                  * Filter the default twentysixteen image attachment size.
39                                                                  *
40                                                                  * @since Twenty Sixteen 1.0
41                                                                  *
42                                                                  * @param string $image_size Image size. Default 'large'.
43                                                                  */
44                                                                 $image_size = apply_filters( 'twentysixteen_attachment_size', 'large' );
45
46                                                                 echo wp_get_attachment_image( get_the_ID(), $image_size );
47                                                         ?>
48
49                                                         <?php twentysixteen_excerpt( 'entry-caption' ); ?>
50
51                                                 </div><!-- .entry-attachment -->
52
53                                                 <?php
54                                                         the_content();
55                                                         wp_link_pages( array(
56                                                                 'before'      => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentysixteen' ) . '</span>',
57                                                                 'after'       => '</div>',
58                                                                 'link_before' => '<span>',
59                                                                 'link_after'  => '</span>',
60                                                                 'pagelink'    => '<span class="screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>%',
61                                                                 'separator'   => '<span class="screen-reader-text">, </span>',
62                                                         ) );
63                                                 ?>
64                                         </div><!-- .entry-content -->
65
66                                         <footer class="entry-footer">
67                                                 <?php twentysixteen_entry_meta(); ?>
68                                                 <?php
69                                                         // Retrieve attachment metadata.
70                                                         $metadata = wp_get_attachment_metadata();
71                                                         if ( $metadata ) {
72                                                                 printf( '<span class="full-size-link"><span class="screen-reader-text">%1$s </span><a href="%2$s">%3$s &times; %4$s</a></span>',
73                                                                         esc_html_x( 'Full size', 'Used before full size attachment link.', 'twentysixteen' ),
74                                                                         esc_url( wp_get_attachment_url() ),
75                                                                         absint( $metadata['width'] ),
76                                                                         absint( $metadata['height'] )
77                                                                 );
78                                                         }
79                                                 ?>
80                                                 <?php
81                                                         edit_post_link(
82                                                                 sprintf(
83                                                                         /* translators: %s: Name of current post */
84                                                                         __( 'Edit<span class="screen-reader-text"> "%s"</span>', 'twentysixteen' ),
85                                                                         get_the_title()
86                                                                 ),
87                                                                 '<span class="edit-link">',
88                                                                 '</span>'
89                                                         );
90                                                 ?>
91                                         </footer><!-- .entry-footer -->
92                                 </article><!-- #post-## -->
93
94                                 <?php
95                                         // If comments are open or we have at least one comment, load up the comment template.
96                                         if ( comments_open() || get_comments_number() ) {
97                                                 comments_template();
98                                         }
99
100                                         // Parent post navigation.
101                                         the_post_navigation( array(
102                                                 'prev_text' => _x( '<span class="meta-nav">Published in</span><span class="post-title">%title</span>', 'Parent post link', 'twentysixteen' ),
103                                         ) );
104                                 // End the loop.
105                                 endwhile;
106                         ?>
107
108                 </main><!-- .site-main -->
109         </div><!-- .content-area -->
110
111 <?php get_sidebar(); ?>
112 <?php get_footer(); ?>