image.php 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. <?php
  2. /**
  3. * The template for displaying image attachments
  4. *
  5. * @package WordPress
  6. * @subpackage Twenty_Fifteen
  7. * @since Twenty Fifteen 1.0
  8. */
  9. get_header(); ?>
  10. <div id="primary" class="content-area">
  11. <main id="main" class="site-main" role="main">
  12. <?php
  13. // Start the loop.
  14. while ( have_posts() ) : the_post();
  15. ?>
  16. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  17. <nav id="image-navigation" class="navigation image-navigation">
  18. <div class="nav-links">
  19. <div class="nav-previous"><?php previous_image_link( false, __( 'Previous Image', 'twentyfifteen' ) ); ?></div><div class="nav-next"><?php next_image_link( false, __( 'Next Image', 'twentyfifteen' ) ); ?></div>
  20. </div><!-- .nav-links -->
  21. </nav><!-- .image-navigation -->
  22. <header class="entry-header">
  23. <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
  24. </header><!-- .entry-header -->
  25. <div class="entry-content">
  26. <div class="entry-attachment">
  27. <?php
  28. /**
  29. * Filter the default Twenty Fifteen image attachment size.
  30. *
  31. * @since Twenty Fifteen 1.0
  32. *
  33. * @param string $image_size Image size. Default 'large'.
  34. */
  35. $image_size = apply_filters( 'twentyfifteen_attachment_size', 'large' );
  36. echo wp_get_attachment_image( get_the_ID(), $image_size );
  37. ?>
  38. <?php if ( has_excerpt() ) : ?>
  39. <div class="entry-caption">
  40. <?php the_excerpt(); ?>
  41. </div><!-- .entry-caption -->
  42. <?php endif; ?>
  43. </div><!-- .entry-attachment -->
  44. <?php
  45. the_content();
  46. wp_link_pages( array(
  47. 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'twentyfifteen' ) . '</span>',
  48. 'after' => '</div>',
  49. 'link_before' => '<span>',
  50. 'link_after' => '</span>',
  51. 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'twentyfifteen' ) . ' </span>%',
  52. 'separator' => '<span class="screen-reader-text">, </span>',
  53. ) );
  54. ?>
  55. </div><!-- .entry-content -->
  56. <footer class="entry-footer">
  57. <?php twentyfifteen_entry_meta(); ?>
  58. <?php edit_post_link( __( 'Edit', 'twentyfifteen' ), '<span class="edit-link">', '</span>' ); ?>
  59. </footer><!-- .entry-footer -->
  60. </article><!-- #post-## -->
  61. <?php
  62. // If comments are open or we have at least one comment, load up the comment template
  63. if ( comments_open() || get_comments_number() ) :
  64. comments_template();
  65. endif;
  66. // Previous/next post navigation.
  67. the_post_navigation( array(
  68. 'prev_text' => _x( '<span class="meta-nav">Published in</span><span class="post-title">%title</span>', 'Parent post link', 'twentyfifteen' ),
  69. ) );
  70. // End the loop.
  71. endwhile;
  72. ?>
  73. </main><!-- .site-main -->
  74. </div><!-- .content-area -->
  75. <?php get_footer(); ?>