| 1 | <?php |
|---|
| 2 | /** |
|---|
| 3 | * The template for displaying image attachments |
|---|
| 4 | * |
|---|
| 5 | * @package WordPress |
|---|
| 6 | * @subpackage Twenty_Nineteen |
|---|
| 7 | * @since Twenty Nineteen 1.0 |
|---|
| 8 | */ |
|---|
| 9 | |
|---|
| 10 | get_header(); |
|---|
| 11 | ?> |
|---|
| 12 | |
|---|
| 13 | <div id="primary" class="content-area"> |
|---|
| 14 | <main id="main" class="site-main"> |
|---|
| 15 | |
|---|
| 16 | <?php |
|---|
| 17 | // Start the Loop. |
|---|
| 18 | while ( have_posts() ) : |
|---|
| 19 | the_post(); |
|---|
| 20 | ?> |
|---|
| 21 | |
|---|
| 22 | <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>> |
|---|
| 23 | |
|---|
| 24 | <header class="entry-header"> |
|---|
| 25 | <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?> |
|---|
| 26 | </header><!-- .entry-header --> |
|---|
| 27 | |
|---|
| 28 | <div class="entry-content"> |
|---|
| 29 | |
|---|
| 30 | <figure class="entry-attachment wp-block-image"> |
|---|
| 31 | <?php |
|---|
| 32 | /** |
|---|
| 33 | * Filters the default twentynineteen image attachment size. |
|---|
| 34 | * |
|---|
| 35 | * @since Twenty Sixteen 1.0 |
|---|
| 36 | * |
|---|
| 37 | * @param string $image_size Image size. Default 'large'. |
|---|
| 38 | */ |
|---|
| 39 | $image_size = apply_filters( 'twentynineteen_attachment_size', 'full' ); |
|---|
| 40 | |
|---|
| 41 | echo wp_get_attachment_image( get_the_ID(), $image_size ); |
|---|
| 42 | ?> |
|---|
| 43 | |
|---|
| 44 | <figcaption class="wp-caption-text"><?php the_excerpt(); ?></figcaption> |
|---|
| 45 | |
|---|
| 46 | </figure><!-- .entry-attachment --> |
|---|
| 47 | |
|---|
| 48 | <?php |
|---|
| 49 | the_content(); |
|---|
| 50 | wp_link_pages( |
|---|
| 51 | array( |
|---|
| 52 | 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentynineteen' ) . '</span>', |
|---|
| 53 | 'after' => '</div>', |
|---|
| 54 | 'link_before' => '<span>', |
|---|
| 55 | 'link_after' => '</span>', |
|---|
| 56 | 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentynineteen' ) . ' </span>%', |
|---|
| 57 | 'separator' => '<span class="screen-reader-text">, </span>', |
|---|
| 58 | ) |
|---|
| 59 | ); |
|---|
| 60 | ?> |
|---|
| 61 | </div><!-- .entry-content --> |
|---|
| 62 | |
|---|
| 63 | <footer class="entry-footer"> |
|---|
| 64 | <?php |
|---|
| 65 | // Retrieve attachment metadata. |
|---|
| 66 | $metadata = wp_get_attachment_metadata(); |
|---|
| 67 | if ( $metadata ) { |
|---|
| 68 | printf( |
|---|
| 69 | '<span class="full-size-link"><span class="screen-reader-text">%1$s</span><a href="%2$s">%3$s × %4$s</a></span>', |
|---|
| 70 | _x( 'Full size', 'Used before full size attachment link.', 'twentynineteen' ), |
|---|
| 71 | esc_url( wp_get_attachment_url() ), |
|---|
| 72 | absint( $metadata['width'] ), |
|---|
| 73 | absint( $metadata['height'] ) |
|---|
| 74 | ); |
|---|
| 75 | } |
|---|
| 76 | ?> |
|---|
| 77 | |
|---|
| 78 | <?php twentynineteen_entry_footer(); ?> |
|---|
| 79 | |
|---|
| 80 | </footer><!-- .entry-footer --> |
|---|
| 81 | </article><!-- #post-<?php the_ID(); ?> --> |
|---|
| 82 | |
|---|
| 83 | <?php |
|---|
| 84 | // Parent post navigation. |
|---|
| 85 | the_post_navigation( |
|---|
| 86 | array( |
|---|
| 87 | 'prev_text' => _x( '<span class="meta-nav">Published in</span><br><span class="post-title">%title</span>', 'Parent post link', 'twentynineteen' ), |
|---|
| 88 | ) |
|---|
| 89 | ); |
|---|
| 90 | |
|---|
| 91 | // If comments are open or we have at least one comment, load up the comment template. |
|---|
| 92 | if ( comments_open() || get_comments_number() ) { |
|---|
| 93 | comments_template(); |
|---|
| 94 | } |
|---|
| 95 | |
|---|
| 96 | // End the loop. |
|---|
| 97 | endwhile; |
|---|
| 98 | ?> |
|---|
| 99 | |
|---|
| 100 | </main><!-- .site-main --> |
|---|
| 101 | </div><!-- .content-area --> |
|---|
| 102 | |
|---|
| 103 | <?php |
|---|
| 104 | get_footer(); |
|---|