[ Index ]

PHP Cross Reference of WordPress

title

Body

[close]

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

   1  <?php
   2  /**
   3   * The template for displaying image attachments
   4   *
   5   * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
   6   *
   7   * @package WordPress
   8   * @subpackage Twenty_Thirteen
   9   * @since Twenty Thirteen 1.0
  10   */
  11  
  12  get_header(); ?>
  13  
  14      <div id="primary" class="content-area">
  15          <div id="content" class="site-content" role="main">
  16  
  17              <?php
  18              // Start the loop.
  19              while ( have_posts() ) :
  20                  the_post();
  21                  ?>
  22  
  23              <article id="post-<?php the_ID(); ?>" <?php post_class( 'image-attachment' ); ?>>
  24              <header class="entry-header">
  25                  <h1 class="entry-title"><?php the_title(); ?></h1>
  26  
  27                  <div class="entry-meta">
  28                      <?php
  29                      /* translators: 1: Date, 2: Date, 3, Parent permalink, 4, Post title, 5: Post title. */
  30                      $published_text = __( 'Published on <time class="entry-date" datetime="%1$s">%2$s</time> in <a href="%3$s" title="Go to %4$s" rel="gallery">%5$s</a>', 'twentythirteen' );
  31                      $published_text = '<span class="attachment-meta">' . $published_text . '</span>';
  32                      $post_title     = get_the_title( $post->post_parent );
  33                      if ( empty( $post_title ) || 0 == $post->post_parent ) {
  34                          $published_text = '<span class="attachment-meta"><time class="entry-date" datetime="%1$s">%2$s</time></span>';
  35                      }
  36  
  37                      printf(
  38                          $published_text,
  39                          esc_attr( get_the_date( 'c' ) ),
  40                          esc_html( get_the_date() ),
  41                          esc_url( get_permalink( $post->post_parent ) ),
  42                          esc_attr( strip_tags( $post_title ) ),
  43                          $post_title
  44                      );
  45  
  46                      $metadata = wp_get_attachment_metadata();
  47                      printf(
  48                          '<span class="attachment-meta full-size-link"><a href="%1$s" title="%2$s">%3$s (%4$s &times; %5$s)</a></span>',
  49                          esc_url( wp_get_attachment_url() ),
  50                          esc_attr__( 'Link to full-size image', 'twentythirteen' ),
  51                          __( 'Full resolution', 'twentythirteen' ),
  52                          $metadata['width'],
  53                          $metadata['height']
  54                      );
  55  
  56                      edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' );
  57                      ?>
  58                      </div><!-- .entry-meta -->
  59                  </header><!-- .entry-header -->
  60  
  61                  <div class="entry-content">
  62                      <nav id="image-navigation" class="navigation image-navigation" role="navigation">
  63                      <span class="nav-previous"><?php previous_image_link( false, __( '<span class="meta-nav">&larr;</span> Previous', 'twentythirteen' ) ); ?></span>
  64                          <span class="nav-next"><?php next_image_link( false, __( 'Next <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?></span>
  65                      </nav><!-- #image-navigation -->
  66  
  67                      <div class="entry-attachment">
  68                          <div class="attachment">
  69                          <?php twentythirteen_the_attached_image(); ?>
  70  
  71                          <?php if ( has_excerpt() ) : ?>
  72                              <div class="entry-caption">
  73                                  <?php the_excerpt(); ?>
  74                              </div>
  75                              <?php endif; ?>
  76                          </div><!-- .attachment -->
  77                      </div><!-- .entry-attachment -->
  78  
  79                      <?php if ( ! empty( $post->post_content ) ) : ?>
  80                      <div class="entry-description">
  81                          <?php the_content(); ?>
  82                          <?php
  83                          wp_link_pages(
  84                              array(
  85                                  'before' => '<div class="page-links">' . __( 'Pages:', 'twentythirteen' ),
  86                                  'after'  => '</div>',
  87                              )
  88                          );
  89                          ?>
  90                      </div><!-- .entry-description -->
  91                      <?php endif; ?>
  92  
  93                  </div><!-- .entry-content -->
  94              </article><!-- #post -->
  95  
  96                  <?php comments_template(); ?>
  97  
  98              <?php endwhile; // End of the loop. ?>
  99  
 100          </div><!-- #content -->
 101      </div><!-- #primary -->
 102  
 103  <?php get_footer(); ?>


Generated: Thu Oct 28 01:00:03 2021 Cross-referenced by PHPXref 0.7.1