archive.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. <?php
  2. /**
  3. * The template for displaying archive pages
  4. *
  5. * Used to display archive-type pages if nothing more specific matches a query.
  6. * For example, puts together date-based pages if no date.php file exists.
  7. *
  8. * If you'd like to further customize these archive views, you may create a
  9. * new template file for each one. For example, tag.php (Tag archives),
  10. * category.php (Category archives), author.php (Author archives), etc.
  11. *
  12. * @link https://codex.wordpress.org/Template_Hierarchy
  13. *
  14. * @package WordPress
  15. * @subpackage Twenty_Sixteen
  16. * @since Twenty Sixteen 1.0
  17. */
  18. get_header(); ?>
  19. <div id="primary" class="content-area">
  20. <main id="main" class="site-main" role="main">
  21. <?php if ( have_posts() ) : ?>
  22. <header class="page-header">
  23. <?php
  24. the_archive_title( '<h1 class="page-title">', '</h1>' );
  25. the_archive_description( '<div class="taxonomy-description">', '</div>' );
  26. ?>
  27. </header><!-- .page-header -->
  28. <?php
  29. // Start the Loop.
  30. while ( have_posts() ) : the_post();
  31. /*
  32. * Include the Post-Format-specific template for the content.
  33. * If you want to override this in a child theme, then include a file
  34. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  35. */
  36. get_template_part( 'template-parts/content', get_post_format() );
  37. // End the loop.
  38. endwhile;
  39. // Previous/next page navigation.
  40. the_posts_pagination( array(
  41. 'prev_text' => __( 'Previous page', 'twentysixteen' ),
  42. 'next_text' => __( 'Next page', 'twentysixteen' ),
  43. 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentysixteen' ) . ' </span>',
  44. ) );
  45. // If no content, include the "No posts found" template.
  46. else :
  47. get_template_part( 'template-parts/content', 'none' );
  48. endif;
  49. ?>
  50. </main><!-- .site-main -->
  51. </div><!-- .content-area -->
  52. <?php get_sidebar(); ?>
  53. <?php get_footer(); ?>