[ 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 = __( '<span class="attachment-meta">Published on <time class="entry-date" datetime="%1$s">%2$s</time> in <a href="%3$s" title="Return to %4$s" rel="gallery">%5$s</a></span>', 'twentythirteen' );
  31                      $post_title     = get_the_title( $post->post_parent );
  32                      if ( empty( $post_title ) || 0 == $post->post_parent ) {
  33                          $published_text = '<span class="attachment-meta"><time class="entry-date" datetime="%1$s">%2$s</time></span>';
  34                      }
  35  
  36                          printf(
  37                              $published_text,
  38                              esc_attr( get_the_date( 'c' ) ),
  39                              esc_html( get_the_date() ),
  40                              esc_url( get_permalink( $post->post_parent ) ),
  41                              esc_attr( strip_tags( $post_title ) ),
  42                              $post_title
  43                          );
  44  
  45                          $metadata = wp_get_attachment_metadata();
  46                          printf(
  47                              '<span class="attachment-meta full-size-link"><a href="%1$s" title="%2$s">%3$s (%4$s &times; %5$s)</a></span>',
  48                              esc_url( wp_get_attachment_url() ),
  49                              esc_attr__( 'Link to full-size image', 'twentythirteen' ),
  50                              __( 'Full resolution', 'twentythirteen' ),
  51                              $metadata['width'],
  52                              $metadata['height']
  53                          );
  54  
  55                          edit_post_link( __( 'Edit', 'twentythirteen' ), '<span class="edit-link">', '</span>' );
  56                      ?>
  57                      </div><!-- .entry-meta -->
  58                  </header><!-- .entry-header -->
  59  
  60                  <div class="entry-content">
  61                      <nav id="image-navigation" class="navigation image-navigation" role="navigation">
  62                      <span class="nav-previous"><?php previous_image_link( false, __( '<span class="meta-nav">&larr;</span> Previous', 'twentythirteen' ) ); ?></span>
  63                          <span class="nav-next"><?php next_image_link( false, __( 'Next <span class="meta-nav">&rarr;</span>', 'twentythirteen' ) ); ?></span>
  64                      </nav><!-- #image-navigation -->
  65  
  66                      <div class="entry-attachment">
  67                          <div class="attachment">
  68                          <?php twentythirteen_the_attached_image(); ?>
  69  
  70                          <?php if ( has_excerpt() ) : ?>
  71                              <div class="entry-caption">
  72                                  <?php the_excerpt(); ?>
  73                              </div>
  74                              <?php endif; ?>
  75                          </div><!-- .attachment -->
  76                      </div><!-- .entry-attachment -->
  77  
  78                      <?php if ( ! empty( $post->post_content ) ) : ?>
  79                      <div class="entry-description">
  80                          <?php the_content(); ?>
  81                          <?php
  82                          wp_link_pages(
  83                              array(
  84                                  'before' => '<div class="page-links">' . __( 'Pages:', 'twentythirteen' ),
  85                                  'after'  => '</div>',
  86                              )
  87                          );
  88                          ?>
  89                      </div><!-- .entry-description -->
  90                      <?php endif; ?>
  91  
  92                  </div><!-- .entry-content -->
  93              </article><!-- #post -->
  94  
  95                  <?php comments_template(); ?>
  96  
  97              <?php endwhile; // End the loop. ?>
  98  
  99          </div><!-- #content -->
 100      </div><!-- #primary -->
 101  
 102  <?php get_footer(); ?>


Generated: Sat Sep 21 01:00:03 2019 Cross-referenced by PHPXref 0.7.1