image.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /**
  3. * The template for displaying image attachments
  4. *
  5. * @package WordPress
  6. * @subpackage Varia
  7. * @since 1.0.0
  8. */
  9. get_header();
  10. ?>
  11. <section id="primary" class="content-area">
  12. <main id="main" class="site-main">
  13. <?php
  14. // Start the loop.
  15. while ( have_posts() ) :
  16. the_post();
  17. ?>
  18. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  19. <nav id="image-navigation" class="navigation image-navigation responsive-max-width">
  20. <div class="nav-links">
  21. <div class="nav-previous"><?php previous_image_link( false, __( 'Previous Image', 'varia' ) ); ?></div>
  22. <div class="nav-next"><?php next_image_link( false, __( 'Next Image', 'varia' ) ); ?></div>
  23. </div><!-- .nav-links -->
  24. </nav><!-- .image-navigation -->
  25. <header class="entry-header responsive-max-width">
  26. <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
  27. </header><!-- .entry-header -->
  28. <div class="entry-content">
  29. <figure class="entry-attachment wp-block-image">
  30. <?php
  31. /**
  32. * Filter the default varia image attachment size.
  33. *
  34. * @since Twenty Sixteen 1.0
  35. *
  36. * @param string $image_size Image size. Default 'large'.
  37. */
  38. $image_size = apply_filters( 'varia_attachment_size', 'full' );
  39. echo wp_get_attachment_image( get_the_ID(), $image_size );
  40. ?>
  41. <figcaption class="wp-caption-text"><?php the_excerpt(); ?></figcaption>
  42. </figure><!-- .entry-attachment -->
  43. <?php
  44. the_content();
  45. wp_link_pages(
  46. array(
  47. 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'varia' ) . '</span>',
  48. 'after' => '</div>',
  49. 'link_before' => '<span>',
  50. 'link_after' => '</span>',
  51. 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'varia' ) . ' </span>%',
  52. 'separator' => '<span class="screen-reader-text">, </span>',
  53. )
  54. );
  55. ?>
  56. </div><!-- .entry-content -->
  57. <footer class="entry-footer responsive-max-width">
  58. <?php
  59. // Retrieve attachment metadata.
  60. $metadata = wp_get_attachment_metadata();
  61. if ( $metadata ) {
  62. printf(
  63. '<span class="full-size-link"><span class="screen-reader-text">%1$s</span><a href="%2$s">%3$s &times; %4$s</a></span>',
  64. _x( 'Full size', 'Used before full size attachment link.', 'varia' ),
  65. esc_url( wp_get_attachment_url() ),
  66. absint( $metadata['width'] ),
  67. absint( $metadata['height'] )
  68. );
  69. }
  70. ?>
  71. <?php varia_entry_footer(); ?>
  72. </footer><!-- .entry-footer -->
  73. </article><!-- #post-## -->
  74. <?php
  75. // Parent post navigation.
  76. the_post_navigation(
  77. array(
  78. 'prev_text' => _x( '<span class="meta-nav">Published in</span><br><span class="post-title">%title</span>', 'Parent post link', 'varia' ),
  79. )
  80. );
  81. // If comments are open or we have at least one comment, load up the comment template.
  82. if ( comments_open() || get_comments_number() ) {
  83. comments_template();
  84. }
  85. // End the loop.
  86. endwhile;
  87. ?>
  88. </main><!-- .site-main -->
  89. </section><!-- .content-area -->
  90. <?php
  91. get_footer();