A WordPress theme I used to use on www.chriswiegman.com.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
 
 
 
 
 
 

191 lines
4.5 KiB

  1. <?php
  2. /**
  3. * The template for displaying archive pages.
  4. *
  5. * Template Name: Archive page
  6. *
  7. * @since 5.0.0
  8. *
  9. * @package CW\Theme\Templates\Archive
  10. *
  11. * @author Chris Wiegman <chris@chriswiegman.com>
  12. */
  13. namespace CW\Theme\Templates\Archive;
  14. use CW\Theme\Functions\Template_Tags;
  15. get_header();
  16. $archive_page = false;
  17. ?>
  18. <section id="primary" class="content-area">
  19. <main id="main" class="site-main" role="main">
  20. <?php
  21. if ( have_posts() ) {
  22. ?>
  23. <header class="page-header">
  24. <h1 class="page-title">
  25. <?php
  26. if ( is_category() ) :
  27. single_cat_title();
  28. esc_html_e( ' Posts', 'chriswiegman' );
  29. elseif ( is_tag() ) :
  30. single_tag_title();
  31. elseif ( is_author() ) :
  32. // translators: author name.
  33. printf( esc_html__( 'Author: %s', 'chriswiegman' ), '<span class="vcard">' . get_the_author() . '</span>' );
  34. elseif ( is_day() ) :
  35. // translators: the date.
  36. printf( esc_html__( 'Day: %s', 'chriswiegman' ), '<span>' . get_the_date() . '</span>' );
  37. elseif ( is_month() ) :
  38. // translators: the month.
  39. printf( esc_html__( 'Month: %s', 'chriswiegman' ), '<span>' . get_the_date( _x( 'F Y', 'monthly archives date format', 'chriswiegman' ) ) . '</span>' );
  40. elseif ( is_year() ) :
  41. // translators: the year.
  42. printf( esc_html__( 'Year: %s', 'chriswiegman' ), '<span>' . get_the_date( _x( 'Y', 'yearly archives date format', 'chriswiegman' ) ) . '</span>' );
  43. elseif ( is_tax( 'post_format', 'post-format-aside' ) ) :
  44. esc_html_e( 'Asides', 'chriswiegman' );
  45. elseif ( is_tax( 'post_format', 'post-format-gallery' ) ) :
  46. esc_html_e( 'Galleries', 'chriswiegman' );
  47. elseif ( is_tax( 'post_format', 'post-format-image' ) ) :
  48. esc_html_e( 'Images', 'chriswiegman' );
  49. elseif ( is_tax( 'post_format', 'post-format-video' ) ) :
  50. esc_html_e( 'Videos', 'chriswiegman' );
  51. elseif ( is_tax( 'post_format', 'post-format-quote' ) ) :
  52. esc_html_e( 'Quotes', 'chriswiegman' );
  53. elseif ( is_tax( 'post_format', 'post-format-link' ) ) :
  54. esc_html_e( 'Links', 'chriswiegman' );
  55. elseif ( is_tax( 'post_format', 'post-format-status' ) ) :
  56. esc_html_e( 'Statuses', 'chriswiegman' );
  57. elseif ( is_tax( 'post_format', 'post-format-audio' ) ) :
  58. esc_html_e( 'Audios', 'chriswiegman' );
  59. elseif ( is_tax( 'post_format', 'post-format-chat' ) ) :
  60. esc_html_e( 'Chats', 'chriswiegman' );
  61. else :
  62. $archive_page = true;
  63. endif;
  64. ?>
  65. </h1>
  66. </header><!-- .page-header -->
  67. <?php
  68. if ( true === $archive_page ) {
  69. while ( have_posts() ) :
  70. the_post();
  71. ?>
  72. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  73. <header class="entry-header">
  74. <?php the_title( '<h1 class="entry-title">', '</h1>' ); ?>
  75. </header>
  76. <!-- .entry-header -->
  77. <div class="entry-content">
  78. <?php the_content(); ?>
  79. <div class="archive-page">
  80. <h4><?php esc_html_e( 'Pages:', 'chriswiegman' ); ?></h4>
  81. <ul>
  82. <?php wp_list_pages( array( 'title_li' => '' ) ); ?>
  83. </ul>
  84. <h4><?php esc_html_e( '50 Latest Posts:', 'chriswiegman' ); ?></h4>
  85. <ul>
  86. <?php wp_get_archives( 'type=postbypost&limit=50' ); ?>
  87. </ul>
  88. </div>
  89. <!-- end .archive-page-->
  90. <div class="archive-page">
  91. <h4><?php esc_html_e( 'Categories:', 'chriswiegman' ); ?></h4>
  92. <ul>
  93. <?php wp_list_categories( 'sort_column=name&title_li=' ); ?>
  94. </ul>
  95. </div>
  96. <div class="clear"></div>
  97. <!-- end .archive-page-->
  98. <?php
  99. wp_link_pages(
  100. array(
  101. 'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'chriswiegman' ),
  102. 'after' => '</div>',
  103. )
  104. );
  105. ?>
  106. </div>
  107. <!-- .entry-content -->
  108. <footer class="entry-footer">
  109. <?php edit_post_link( esc_html__( 'Edit', 'chriswiegman' ), '<span class="edit-link">', '</span>' ); ?>
  110. </footer>
  111. <!-- .entry-footer -->
  112. </article><!-- #post-## -->
  113. <?php
  114. endwhile; // End of the loop.
  115. } else {
  116. while ( have_posts() ) {
  117. the_post();
  118. get_template_part( 'template-parts/content', get_post_format() );
  119. }
  120. Template_Tags\paging_nav();
  121. }
  122. } else {
  123. get_template_part( 'template-parts/content', 'none' );
  124. }
  125. ?>
  126. </main><!-- #main -->
  127. </section><!-- #primary -->
  128. <?php
  129. get_sidebar();
  130. get_footer();