index.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. /**
  3. * The main template file
  4. *
  5. * This is the most generic template file in a WordPress theme
  6. * and one of the two required files for a theme (the other being style.css).
  7. * It is used to display a page when nothing more specific matches a query.
  8. * E.g., it puts together the home page when no home.php file exists.
  9. *
  10. * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  11. *
  12. * @package WordPress
  13. * @subpackage Twenty_Twenty_One
  14. * @since Twenty Twenty-One 1.0
  15. */
  16. get_header(); ?>
  17. <?php if ( is_home() && ! is_front_page() && ! empty( single_post_title( '', false ) ) ) : ?>
  18. <header class="page-header alignwide">
  19. <h1 class="page-title"><?php single_post_title(); ?></h1>
  20. </header><!-- .page-header -->
  21. <?php endif; ?>
  22. <?php
  23. if ( have_posts() ) {
  24. // Load posts loop.
  25. while ( have_posts() ) {
  26. the_post();
  27. get_template_part( 'template-parts/content/content', get_theme_mod( 'display_excerpt_or_full_post', 'excerpt' ) );
  28. }
  29. // Previous/next page navigation.
  30. twenty_twenty_one_the_posts_navigation();
  31. } else {
  32. // If no content, include the "No posts found" template.
  33. get_template_part( 'template-parts/content/content-none' );
  34. }
  35. get_footer();