image.php 2.8 KB

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