index.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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_Seventeen
  14. * @since 1.0
  15. * @version 1.0
  16. */
  17. get_header(); ?>
  18. <div class="wrap">
  19. <?php if ( is_home() && ! is_front_page() ) : ?>
  20. <header class="page-header">
  21. <h1 class="page-title"><?php single_post_title(); ?></h1>
  22. </header>
  23. <?php else : ?>
  24. <header class="page-header">
  25. <h2 class="page-title"><?php _e( 'Posts', 'twentyseventeen' ); ?></h2>
  26. </header>
  27. <?php endif; ?>
  28. <div id="primary" class="content-area">
  29. <main id="main" class="site-main" role="main">
  30. <?php
  31. if ( have_posts() ) :
  32. /* Start the Loop */
  33. while ( have_posts() ) :
  34. the_post();
  35. /*
  36. * Include the Post-Format-specific template for the content.
  37. * If you want to override this in a child theme, then include a file
  38. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  39. */
  40. get_template_part( 'template-parts/post/content', get_post_format() );
  41. endwhile;
  42. the_posts_pagination(
  43. array(
  44. 'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>',
  45. 'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ),
  46. 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>',
  47. )
  48. );
  49. else :
  50. get_template_part( 'template-parts/post/content', 'none' );
  51. endif;
  52. ?>
  53. </main><!-- #main -->
  54. </div><!-- #primary -->
  55. <?php get_sidebar(); ?>
  56. </div><!-- .wrap -->
  57. <?php
  58. get_footer();