archive.php 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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 Fifteen
  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_Fifteen
  17. * @since Twenty Fifteen 1.0
  18. */
  19. get_header(); ?>
  20. <section id="primary" class="content-area">
  21. <main id="main" class="site-main" role="main">
  22. <?php if ( have_posts() ) : ?>
  23. <header class="page-header">
  24. <h1 class="page-title">
  25. <?php
  26. if ( is_category() ) :
  27. single_cat_title();
  28. elseif ( is_tag() ) :
  29. single_tag_title();
  30. elseif ( is_author() ) :
  31. printf( esc_html__( 'Author: %s', 'twentyfifteen' ), '<span class="vcard">' . get_the_author() . '</span>' );
  32. elseif ( is_day() ) :
  33. printf( esc_html__( 'Day: %s', 'twentyfifteen' ), get_the_date() );
  34. elseif ( is_month() ) :
  35. printf( esc_html__( 'Month: %s', 'twentyfifteen' ), get_the_date( _x( 'F Y', 'monthly archives date format', 'twentyfifteen' ) ) );
  36. elseif ( is_year() ) :
  37. printf( esc_html__( 'Year: %s', 'twentyfifteen' ), get_the_date( _x( 'Y', 'yearly archives date format', 'twentyfifteen' ) ) );
  38. elseif ( is_tax( 'post_format', 'post-format-aside' ) ) :
  39. esc_html_e( 'Asides', 'twentyfifteen' );
  40. elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) :
  41. esc_html_e( 'Galleries', 'twentyfifteen' );
  42. elseif ( is_tax( 'post_format', 'post-format-image' ) ) :
  43. esc_html_e( 'Images', 'twentyfifteen' );
  44. elseif ( is_tax( 'post_format', 'post-format-video' ) ) :
  45. esc_html_e( 'Videos', 'twentyfifteen' );
  46. elseif ( is_tax( 'post_format', 'post-format-quote' ) ) :
  47. esc_html_e( 'Quotes', 'twentyfifteen' );
  48. elseif ( is_tax( 'post_format', 'post-format-link' ) ) :
  49. esc_html_e( 'Links', 'twentyfifteen' );
  50. elseif ( is_tax( 'post_format', 'post-format-status' ) ) :
  51. esc_html_e( 'Statuses', 'twentyfifteen' );
  52. elseif ( is_tax( 'post_format', 'post-format-audio' ) ) :
  53. esc_html_e( 'Audios', 'twentyfifteen' );
  54. elseif ( is_tax( 'post_format', 'post-format-chat' ) ) :
  55. esc_html_e( 'Chats', 'twentyfifteen' );
  56. else :
  57. esc_html_e( 'Archives', 'twentyfifteen' );
  58. endif;
  59. ?>
  60. </h1>
  61. <?php
  62. // Show an optional term description.
  63. $term_description = term_description();
  64. if ( ! empty( $term_description ) ) :
  65. printf( '<div class="taxonomy-description">%s</div>', $term_description );
  66. endif;
  67. ?>
  68. </header><!-- .page-header -->
  69. <?php /* Start the Loop */ ?>
  70. <?php while ( have_posts() ) : the_post(); ?>
  71. <?php
  72. /* Include the Post-Format-specific template for the content.
  73. * If you want to override this in a child theme, then include a file
  74. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  75. */
  76. get_template_part( 'content', get_post_format() );
  77. ?>
  78. <?php endwhile; ?>
  79. <?php twentyfifteen_paging_nav(); ?>
  80. <?php else : ?>
  81. <?php get_template_part( 'content', 'none' ); ?>
  82. <?php endif; ?>
  83. </main><!-- .site-main -->
  84. </section><!-- .content-area -->
  85. <?php get_footer(); ?>