PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/archive.php

https://github.com/JodiWarren/_s
PHP | 97 lines | 54 code | 22 blank | 21 comment | 8 complexity | 27e8ab7e05b9e7ee26d7c9441b0d1459 MD5 | raw file
Possible License(s): AGPL-1.0
  1. <?php
  2. /**
  3. * The template for displaying Archive pages.
  4. *
  5. * Learn more: http://codex.wordpress.org/Template_Hierarchy
  6. *
  7. * @package _s
  8. * @since _s 1.0
  9. */
  10. get_header(); ?>
  11. <section id="primary" class="content-area">
  12. <div id="content" class="site-content" role="main">
  13. <?php if ( have_posts() ) : ?>
  14. <header class="page-header">
  15. <h1 class="page-title">
  16. <?php
  17. if ( is_category() ) {
  18. printf( __( 'Category Archives: %s', '_s' ), '<span>' . single_cat_title( '', false ) . '</span>' );
  19. } elseif ( is_tag() ) {
  20. printf( __( 'Tag Archives: %s', '_s' ), '<span>' . single_tag_title( '', false ) . '</span>' );
  21. } elseif ( is_author() ) {
  22. /* Queue the first post, that way we know
  23. * what author we're dealing with (if that is the case).
  24. */
  25. the_post();
  26. printf( __( 'Author Archives: %s', '_s' ), '<span class="vcard"><a class="url fn n" href="' . get_author_posts_url( get_the_author_meta( "ID" ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></span>' );
  27. /* Since we called the_post() above, we need to
  28. * rewind the loop back to the beginning that way
  29. * we can run the loop properly, in full.
  30. */
  31. rewind_posts();
  32. } elseif ( is_day() ) {
  33. printf( __( 'Daily Archives: %s', '_s' ), '<span>' . get_the_date() . '</span>' );
  34. } elseif ( is_month() ) {
  35. printf( __( 'Monthly Archives: %s', '_s' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
  36. } elseif ( is_year() ) {
  37. printf( __( 'Yearly Archives: %s', '_s' ), '<span>' . get_the_date( 'Y' ) . '</span>' );
  38. } else {
  39. _e( 'Archives', '_s' );
  40. }
  41. ?>
  42. </h1>
  43. <?php
  44. if ( is_category() ) {
  45. // show an optional category description
  46. $category_description = category_description();
  47. if ( ! empty( $category_description ) )
  48. echo apply_filters( 'category_archive_meta', '<div class="taxonomy-description">' . $category_description . '</div>' );
  49. } elseif ( is_tag() ) {
  50. // show an optional tag description
  51. $tag_description = tag_description();
  52. if ( ! empty( $tag_description ) )
  53. echo apply_filters( 'tag_archive_meta', '<div class="taxonomy-description">' . $tag_description . '</div>' );
  54. }
  55. ?>
  56. </header><!-- .page-header -->
  57. <?php _s_content_nav( 'nav-above' ); ?>
  58. <?php /* Start the Loop */ ?>
  59. <?php while ( have_posts() ) : the_post(); ?>
  60. <?php
  61. /* Include the Post-Format-specific template for the content.
  62. * If you want to overload this in a child theme then include a file
  63. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  64. */
  65. get_template_part( 'content', get_post_format() );
  66. ?>
  67. <?php endwhile; ?>
  68. <?php _s_content_nav( 'nav-below' ); ?>
  69. <?php else : ?>
  70. <?php get_template_part( 'no-results', 'archive' ); ?>
  71. <?php endif; ?>
  72. </div><!-- #content .site-content -->
  73. </section><!-- #primary .content-area -->
  74. <?php get_sidebar(); ?>
  75. <?php get_footer(); ?>