image.php 3.2 KB

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