image.php 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. <?php
  2. /**
  3. * The template for displaying image attachments
  4. *
  5. * @package Seedlet
  6. * @since 1.0.0
  7. */
  8. get_header();
  9. ?>
  10. <section id="primary" class="content-area">
  11. <main id="main" class="site-main" role="main">
  12. <?php
  13. // Start the loop.
  14. while ( have_posts() ) :
  15. the_post();
  16. ?>
  17. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  18. <nav id="image-navigation" class="navigation image-navigation default-max-width">
  19. <div class="nav-links">
  20. <div class="nav-previous"><?php previous_image_link( false, __( 'Previous Image', 'seedlet' ) ); ?></div>
  21. <div class="nav-next"><?php next_image_link( false, __( 'Next Image', 'seedlet' ) ); ?></div>
  22. </div><!-- .nav-links -->
  23. </nav><!-- .image-navigation -->
  24. <header class="entry-header default-max-width">
  25. <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
  26. </header><!-- .entry-header -->
  27. <div class="entry-content">
  28. <figure class="entry-attachment wp-block-image">
  29. <?php
  30. /**
  31. * Filter the default seedlet image attachment size.
  32. *
  33. * @since Seedlet 1.0
  34. *
  35. * @param string $image_size Image size. Default 'large'.
  36. */
  37. $image_size = apply_filters( 'seedlet_attachment_size', 'full' );
  38. echo wp_get_attachment_image( get_the_ID(), $image_size );
  39. ?>
  40. <figcaption class="wp-caption-text"><?php the_excerpt(); ?></figcaption>
  41. </figure><!-- .entry-attachment -->
  42. <?php
  43. the_content();
  44. wp_link_pages(
  45. array(
  46. 'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'seedlet' ) . '</span>',
  47. 'after' => '</div>',
  48. 'link_before' => '<span>',
  49. 'link_after' => '</span>',
  50. 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'seedlet' ) . ' </span>%',
  51. 'separator' => '<span class="screen-reader-text">, </span>',
  52. )
  53. );
  54. ?>
  55. </div><!-- .entry-content -->
  56. <footer class="entry-footer default-max-width">
  57. <?php
  58. // Retrieve attachment metadata.
  59. $metadata = wp_get_attachment_metadata();
  60. if ( $metadata ) {
  61. printf(
  62. '<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>',
  63. _x( 'Full size', 'Used before full size attachment link.', 'seedlet' ),
  64. seedlet_get_icon_svg( 'download', 16 ),
  65. esc_url( wp_get_attachment_url() ),
  66. absint( $metadata['width'] ),
  67. absint( $metadata['height'] )
  68. );
  69. }
  70. ?>
  71. <?php seedlet_entry_meta_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', 'seedlet' ),
  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();