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 Seedlet
  7. * @since 1.0.0
  8. */
  9. get_header();
  10. ?>
  11. <section id="primary" class="content-area">
  12. <main id="main" class="site-main" role="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 default-max-width">
  20. <div class="nav-links">
  21. <div class="nav-previous"><?php previous_image_link( false, __( 'Previous Image', 'seedlet' ) ); ?></div>
  22. <div class="nav-next"><?php next_image_link( false, __( 'Next Image', 'seedlet' ) ); ?></div>
  23. </div><!-- .nav-links -->
  24. </nav><!-- .image-navigation -->
  25. <header class="entry-header default-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 seedlet image attachment size.
  33. *
  34. * @since Seedlet 1.0
  35. *
  36. * @param string $image_size Image size. Default 'large'.
  37. */
  38. $image_size = apply_filters( 'seedlet_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:', 'seedlet' ) . '</span>',
  48. 'after' => '</div>',
  49. 'link_before' => '<span>',
  50. 'link_after' => '</span>',
  51. 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'seedlet' ) . ' </span>%',
  52. 'separator' => '<span class="screen-reader-text">, </span>',
  53. )
  54. );
  55. ?>
  56. </div><!-- .entry-content -->
  57. <footer class="entry-footer default-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>%2$s<a href="%3$s">%4$s &times; %5$s</a></span>',
  64. _x( 'Full size', 'Used before full size attachment link.', 'seedlet' ),
  65. seedlet_get_icon_svg( 'download', 16 ),
  66. esc_url( wp_get_attachment_url() ),
  67. absint( $metadata['width'] ),
  68. absint( $metadata['height'] )
  69. );
  70. }
  71. ?>
  72. <?php seedlet_entry_meta_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', 'seedlet' ),
  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();