image.php 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * The template for displaying image attachments
  4. *
  5. * @package WordPress
  6. * @subpackage Twenty_Fourteen
  7. * @since Twenty Fourteen 1.0
  8. */
  9. // Retrieve attachment metadata.
  10. $metadata = wp_get_attachment_metadata();
  11. get_header();
  12. ?>
  13. <section id="primary" class="content-area image-attachment">
  14. <div id="content" class="site-content" role="main">
  15. <?php
  16. // Start the Loop.
  17. while ( have_posts() ) : the_post();
  18. ?>
  19. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  20. <header class="entry-header">
  21. <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
  22. <div class="entry-meta">
  23. <span class="entry-date"><time class="entry-date" datetime="<?php echo esc_attr( get_the_date( 'c' ) ); ?>"><?php echo esc_html( get_the_date() ); ?></time></span>
  24. <span class="full-size-link"><a href="<?php echo esc_url( wp_get_attachment_url() ); ?>"><?php echo esc_html( $metadata['width'] ); ?> &times; <?php echo esc_html( $metadata['height'] ); ?></a></span>
  25. <span class="parent-post-link"><a href="<?php echo esc_url( get_permalink( $post->post_parent ) ); ?>" rel="gallery"><?php echo get_the_title( $post->post_parent ); ?></a></span>
  26. <?php edit_post_link( __( 'Edit', 'twentyfourteen' ), '<span class="edit-link">', '</span>' ); ?>
  27. </div><!-- .entry-meta -->
  28. </header><!-- .entry-header -->
  29. <div class="entry-content">
  30. <div class="entry-attachment">
  31. <div class="attachment">
  32. <?php twentyfourteen_the_attached_image(); ?>
  33. </div><!-- .attachment -->
  34. <?php if ( has_excerpt() ) : ?>
  35. <div class="entry-caption">
  36. <?php the_excerpt(); ?>
  37. </div><!-- .entry-caption -->
  38. <?php endif; ?>
  39. </div><!-- .entry-attachment -->
  40. <?php
  41. the_content();
  42. wp_link_pages( array(
  43. 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfourteen' ) . '</span>',
  44. 'after' => '</div>',
  45. 'link_before' => '<span>',
  46. 'link_after' => '</span>',
  47. ) );
  48. ?>
  49. </div><!-- .entry-content -->
  50. </article><!-- #post-## -->
  51. <nav id="image-navigation" class="navigation image-navigation">
  52. <div class="nav-links">
  53. <?php previous_image_link( false, '<div class="previous-image">' . __( 'Previous Image', 'twentyfourteen' ) . '</div>' ); ?>
  54. <?php next_image_link( false, '<div class="next-image">' . __( 'Next Image', 'twentyfourteen' ) . '</div>' ); ?>
  55. </div><!-- .nav-links -->
  56. </nav><!-- #image-navigation -->
  57. <?php comments_template(); ?>
  58. <?php endwhile; // end of the loop. ?>
  59. </div><!-- #content -->
  60. </section><!-- #primary -->
  61. <?php
  62. get_sidebar();
  63. get_footer();