PageRenderTime 37ms CodeModel.GetById 11ms RepoModel.GetById 0ms app.codeStats 0ms

/archive.php

https://github.com/conorluddy/UnleadedPixel
PHP | 112 lines | 65 code | 27 blank | 20 comment | 8 complexity | 362e62340632d9513aee4531e5019bc9 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 unleadedbase
  8. */
  9. get_header(); ?>
  10. <section id="primary" class="content-area">
  11. <div id="content" class="site-content" role="main">
  12. <?php if ( have_posts() ) : ?>
  13. <header class="page-header">
  14. <h1 class="page-title">
  15. <?php
  16. if ( is_category() ) :
  17. printf( __( 'Category Archives: %s', 'unleadedbase' ), '<span>' . single_cat_title( '', false ) . '</span>' );
  18. elseif ( is_tag() ) :
  19. printf( __( 'Tag Archives: %s', 'unleadedbase' ), '<span>' . single_tag_title( '', false ) . '</span>' );
  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 Archives: %s', 'unleadedbase' ), '<span class="vcard"><a class="url fn n" href="' . esc_url( get_author_posts_url( get_the_author_meta( "ID" ) ) ) . '" title="' . esc_attr( get_the_author() ) . '" rel="me">' . get_the_author() . '</a></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( __( 'Daily Archives: %s', 'unleadedbase' ), '<span>' . get_the_date() . '</span>' );
  33. elseif ( is_month() ) :
  34. printf( __( 'Monthly Archives: %s', 'unleadedbase' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
  35. elseif ( is_year() ) :
  36. printf( __( 'Yearly Archives: %s', 'unleadedbase' ), '<span>' . get_the_date( 'Y' ) . '</span>' );
  37. elseif ( is_tax( 'post_format', 'post-format-aside' ) ) :
  38. _e( 'Asides', 'unleadedbase' );
  39. elseif ( is_tax( 'post_format', 'post-format-image' ) ) :
  40. _e( 'Images', 'unleadedbase');
  41. elseif ( is_tax( 'post_format', 'post-format-video' ) ) :
  42. _e( 'Videos', 'unleadedbase' );
  43. elseif ( is_tax( 'post_format', 'post-format-quote' ) ) :
  44. _e( 'Quotes', 'unleadedbase' );
  45. elseif ( is_tax( 'post_format', 'post-format-link' ) ) :
  46. _e( 'Links', 'unleadedbase' );
  47. else :
  48. _e( 'Archives', 'unleadedbase' );
  49. endif;
  50. ?>
  51. </h1>
  52. <?php
  53. if ( is_category() ) :
  54. // show an optional category description
  55. $category_description = category_description();
  56. if ( ! empty( $category_description ) ) :
  57. echo apply_filters( 'category_archive_meta', '<div class="taxonomy-description">' . $category_description . '</div>' );
  58. endif;
  59. elseif ( is_tag() ) :
  60. // show an optional tag description
  61. $tag_description = tag_description();
  62. if ( ! empty( $tag_description ) ) :
  63. echo apply_filters( 'tag_archive_meta', '<div class="taxonomy-description">' . $tag_description . '</div>' );
  64. endif;
  65. endif;
  66. ?>
  67. </header><!-- .page-header -->
  68. <?php /* Start the Loop */ ?>
  69. <?php while ( have_posts() ) : the_post(); ?>
  70. <?php
  71. /* Include the Post-Format-specific template for the content.
  72. * If you want to overload this in a child theme then include a file
  73. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  74. */
  75. get_template_part( 'content', get_post_format() );
  76. ?>
  77. <?php endwhile; ?>
  78. <?php unleadedbase_content_nav( 'nav-below' ); ?>
  79. <?php else : ?>
  80. <?php get_template_part( 'no-results', 'archive' ); ?>
  81. <?php endif; ?>
  82. </div><!-- #content -->
  83. </section><!-- #primary -->
  84. <?php get_sidebar(); ?>
  85. <?php get_footer(); ?>