archive.php 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 specific one. For example, Twenty Fourteen
  10. * already has tag.php for Tag archives, category.php for Category archives,
  11. * and author.php for Author archives.
  12. *
  13. * @link http://codex.wordpress.org/Template_Hierarchy
  14. *
  15. * @package WordPress
  16. * @subpackage Twenty_Fourteen
  17. * @since Twenty Fourteen 1.0
  18. */
  19. get_header(); ?>
  20. <section id="primary" class="content-area">
  21. <div id="content" class="site-content" role="main">
  22. <?php if ( have_posts() ) : ?>
  23. <header class="page-header">
  24. <h1 class="page-title">
  25. <?php
  26. if ( is_day() ) :
  27. printf( __( 'Daily Archives: %s', 'twentyfourteen' ), get_the_date() );
  28. elseif ( is_month() ) :
  29. printf( __( 'Monthly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyfourteen' ) ) );
  30. elseif ( is_year() ) :
  31. printf( __( 'Yearly Archives: %s', 'twentyfourteen' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyfourteen' ) ) );
  32. else :
  33. _e( 'Archives', 'twentyfourteen' );
  34. endif;
  35. ?>
  36. </h1>
  37. </header><!-- .page-header -->
  38. <?php
  39. // Start the Loop.
  40. while ( have_posts() ) : the_post();
  41. /*
  42. * Include the post format-specific template for the content. If you want to
  43. * use this in a child theme, then include a file called called content-___.php
  44. * (where ___ is the post format) and that will be used instead.
  45. */
  46. get_template_part( 'content', get_post_format() );
  47. endwhile;
  48. // Previous/next page navigation.
  49. if (function_exists("pagination")) : pagination(); endif;
  50. else :
  51. // If no content, include the "No posts found" template.
  52. get_template_part( 'content', 'none' );
  53. endif;
  54. ?>
  55. </div><!-- #content -->
  56. </section><!-- #primary -->
  57. <?php
  58. get_sidebar( 'content' );
  59. get_sidebar();
  60. get_footer();