single.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. <?php declare( strict_types = 1 ); ?>
  2. <?php
  3. /**
  4. * The template for displaying all single posts
  5. *
  6. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/#single-post
  7. *
  8. * @package WordPress
  9. * @subpackage Varia
  10. * @since 1.0.0
  11. */
  12. get_header();
  13. ?>
  14. <section id="primary" class="content-area">
  15. <main id="main" class="site-main">
  16. <?php
  17. /* Start the Loop */
  18. while ( have_posts() ) :
  19. the_post();
  20. get_template_part( 'template-parts/content/content', 'single' );
  21. if ( is_singular( 'attachment' ) ) {
  22. // Parent post navigation.
  23. the_post_navigation(
  24. array(
  25. /* translators: %s: parent post link */
  26. 'prev_text' => sprintf( __( '<span class="meta-nav">Published in</span><br /><span class="post-title">%s</span>', 'varia' ), '%title' ),
  27. )
  28. );
  29. } elseif ( is_singular( 'post' ) ) {
  30. // Previous/next post navigation.
  31. the_post_navigation(
  32. array(
  33. 'next_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Next Post', 'varia' ) . '</span> ' .
  34. '<span class="screen-reader-text">' . __( 'Next post:', 'varia' ) . '</span> <br/>' .
  35. '<span class="post-title">%title</span>',
  36. 'prev_text' => '<span class="meta-nav" aria-hidden="true">' . __( 'Previous Post', 'varia' ) . '</span> ' .
  37. '<span class="screen-reader-text">' . __( 'Previous post:', 'varia' ) . '</span> <br/>' .
  38. '<span class="post-title">%title</span>',
  39. )
  40. );
  41. }
  42. // If comments are open or we have at least one comment, load up the comment template.
  43. if ( comments_open() || get_comments_number() ) {
  44. comments_template();
  45. }
  46. endwhile; // End of the loop.
  47. ?>
  48. </main><!-- #main -->
  49. </section><!-- #primary -->
  50. <?php
  51. get_footer();