index.php 1.3 KB

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