PageRenderTime 79ms CodeModel.GetById 19ms RepoModel.GetById 3ms app.codeStats 0ms

/archive.php

https://github.com/raphqu/minimal-retro
PHP | 102 lines | 58 code | 25 blank | 19 comment | 6 complexity | 53f159d0ab161e1d9ca045afc0cf25a6 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 minimal-retro
  8. */
  9. get_header(); ?>
  10. <section id="primary" class="content-area">
  11. <main id="main" class="site-main" role="main">
  12. <?php if ( have_posts() ) : ?>
  13. <header class="page-header">
  14. <h1 class="page-title">
  15. <?php
  16. if ( is_category() ) :
  17. single_cat_title();
  18. elseif ( is_tag() ) :
  19. single_tag_title();
  20. elseif ( is_author() ) :
  21. /* Queue the first post, that way we know
  22. * what author we're dealing with (if that is the case).
  23. */
  24. the_post();
  25. printf( __( 'Author: %s', 'minimal-retro' ), '<span class="vcard">' . get_the_author() . '</span>' );
  26. /* Since we called the_post() above, we need to
  27. * rewind the loop back to the beginning that way
  28. * we can run the loop properly, in full.
  29. */
  30. rewind_posts();
  31. elseif ( is_day() ) :
  32. printf( __( 'Day: %s', 'minimal-retro' ), '<span>' . get_the_date() . '</span>' );
  33. elseif ( is_month() ) :
  34. printf( __( 'Month: %s', 'minimal-retro' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
  35. elseif ( is_year() ) :
  36. printf( __( 'Year: %s', 'minimal-retro' ), '<span>' . get_the_date( 'Y' ) . '</span>' );
  37. elseif ( is_tax( 'post_format', 'post-format-aside' ) ) :
  38. _e( 'Asides', 'minimal-retro' );
  39. elseif ( is_tax( 'post_format', 'post-format-image' ) ) :
  40. _e( 'Images', 'minimal-retro');
  41. elseif ( is_tax( 'post_format', 'post-format-video' ) ) :
  42. _e( 'Videos', 'minimal-retro' );
  43. elseif ( is_tax( 'post_format', 'post-format-quote' ) ) :
  44. _e( 'Quotes', 'minimal-retro' );
  45. elseif ( is_tax( 'post_format', 'post-format-link' ) ) :
  46. _e( 'Links', 'minimal-retro' );
  47. else :
  48. _e( 'Archives', 'minimal-retro' );
  49. endif;
  50. ?>
  51. </h1>
  52. <?php
  53. // Show an optional term description.
  54. $term_description = term_description();
  55. if ( ! empty( $term_description ) ) :
  56. printf( '<div class="taxonomy-description">%s</div>', $term_description );
  57. endif;
  58. ?>
  59. </header><!-- .page-header -->
  60. <?php /* Start the Loop */ ?>
  61. <?php while ( have_posts() ) : the_post(); ?>
  62. <?php
  63. /* Include the Post-Format-specific template for the content.
  64. * If you want to overload this in a child theme then include a file
  65. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  66. */
  67. get_template_part( 'content', get_post_format() );
  68. ?>
  69. <?php endwhile; ?>
  70. <?php minimal_retro_content_nav( 'nav-below' ); ?>
  71. <?php else : ?>
  72. <?php get_template_part( 'no-results', 'archive' ); ?>
  73. <?php endif; ?>
  74. </main><!-- #main -->
  75. </section><!-- #primary -->
  76. <?php get_sidebar(); ?>
  77. <?php get_footer(); ?>