PageRenderTime 53ms CodeModel.GetById 23ms RepoModel.GetById 0ms app.codeStats 0ms

/archive.php

https://github.com/dmckinley820/braces
PHP | 100 lines | 69 code | 9 blank | 22 comment | 6 complexity | 3d2948ba337153c5e288a869825edd87 MD5 | raw file
  1. <?php
  2. /**
  3. * The template for displaying Archive pages.
  4. *
  5. * Learn more: http://codex.wordpress.org/Template_Hierarchy
  6. *
  7. * @package WordPress
  8. * @subpackage braces
  9. * @author Oomph, Inc.
  10. * @link http://www.oomphinc.com
  11. */
  12. get_header(); ?>
  13. <section id="primary" class="content-area">
  14. <main id="main" class="site-main" role="main">
  15. <?php if ( have_posts() ) { ?>
  16. <header class="page-header">
  17. <h1 class="page-title">
  18. <?php
  19. if ( is_category() ) {
  20. single_cat_title();
  21. }
  22. elseif ( is_tag() ) {
  23. single_tag_title();
  24. }
  25. elseif ( is_author() ) {
  26. /* Queue the first post, that way we know
  27. * what author we're dealing with (if that is the case).
  28. */
  29. the_post();
  30. printf( __( 'Author: %s', 'braces' ), '<span class="vcard">' . get_the_author() . '</span>' );
  31. /* Since we called the_post() above, we need to
  32. * rewind the loop back to the beginning that way
  33. * we can run the loop properly, in full.
  34. */
  35. rewind_posts();
  36. }
  37. elseif ( is_day() ) {
  38. printf( __( 'Day: %s', 'braces' ), '<span>' . get_the_date() . '</span>' );
  39. }
  40. elseif ( is_month() ) {
  41. printf( __( 'Month: %s', 'braces' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
  42. }
  43. elseif ( is_year() ) {
  44. printf( __( 'Year: %s', 'braces' ), '<span>' . get_the_date( 'Y' ) . '</span>' );
  45. }
  46. elseif ( is_tax( 'post_format', 'post-format-aside' ) ) {
  47. _e( 'Asides', 'braces' );
  48. }
  49. elseif ( is_tax( 'post_format', 'post-format-image' ) ) {
  50. _e( 'Images', 'braces');
  51. }
  52. elseif ( is_tax( 'post_format', 'post-format-video' ) ) {
  53. _e( 'Videos', 'braces' );
  54. }
  55. elseif ( is_tax( 'post_format', 'post-format-quote' ) ) {
  56. _e( 'Quotes', 'braces' );
  57. }
  58. elseif ( is_tax( 'post_format', 'post-format-link' ) ) {
  59. _e( 'Links', 'braces' );
  60. }
  61. else {
  62. _e( 'Archives', 'braces' );
  63. } ?>
  64. </h1>
  65. <?php
  66. // Show an optional term description.
  67. $term_description = term_description();
  68. if ( !empty( $term_description ) ) {
  69. printf( '<div class="taxonomy-description">%s</div>', $term_description );
  70. }
  71. ?>
  72. </header><!-- .page-header -->
  73. <?php
  74. while ( have_posts() ) {
  75. the_post();
  76. /* Include the Post-Format-specific template for the content.
  77. * If you want to overload this in a child theme then include a file
  78. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  79. */
  80. get_template_part( 'content', get_post_format() );
  81. }
  82. braces_paging_nav();
  83. }
  84. else {
  85. get_template_part( 'content', 'none' );
  86. } ?>
  87. </main><!-- #main -->
  88. </section><!-- #primary -->
  89. <?php
  90. get_sidebar();
  91. get_footer();