[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

/wp-content/themes/twentysixteen/ -> image.php (source)

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


Generated: Thu Nov 21 01:00:03 2024 Cross-referenced by PHPXref 0.7.1