PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/archive.php

https://github.com/saltcod/local2121
PHP | 104 lines | 57 code | 26 blank | 21 comment | 11 complexity | 7cc4112d214720a8bd7263972a220048 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 waterstreet
  8. * @since waterstreet 1.0
  9. */
  10. get_header(); ?>
  11. <div id="primary" class="content-area wrap group">
  12. <?php if ( is_page( 'questions' ) || is_page( 'information' ) || is_archive() ) {
  13. get_sidebar();
  14. }
  15. ?>
  16. <div id="content" class="site-content group" role="main">
  17. <?php if ( have_posts() ) : ?>
  18. <header class="page-header">
  19. <h1 class="page-title">
  20. <?php
  21. if ( is_category() ) {
  22. printf( __( 'Category Archives: %s', 'waterstreet' ), '<span>' . single_cat_title( '', false ) . '</span>' );
  23. } elseif ( is_tag() ) {
  24. printf( __( 'Tag Archives: %s', 'waterstreet' ), '<span>' . single_tag_title( '', false ) . '</span>' );
  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 Archives: %s', 'waterstreet' ), '<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>' );
  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. } elseif ( is_day() ) {
  37. printf( __( 'Daily Archives: %s', 'waterstreet' ), '<span>' . get_the_date() . '</span>' );
  38. } elseif ( is_month() ) {
  39. printf( __( 'Monthly Archives: %s', 'waterstreet' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
  40. } elseif ( is_year() ) {
  41. printf( __( 'Yearly Archives: %s', 'waterstreet' ), '<span>' . get_the_date( 'Y' ) . '</span>' );
  42. } else {
  43. _e( 'Archives', 'waterstreet' );
  44. }
  45. ?>
  46. </h1>
  47. <?php
  48. if ( is_category() ) {
  49. // show an optional category description
  50. $category_description = category_description();
  51. if ( ! empty( $category_description ) )
  52. echo apply_filters( 'category_archive_meta', '<div class="taxonomy-description">' . $category_description . '</div>' );
  53. } elseif ( is_tag() ) {
  54. // show an optional tag description
  55. $tag_description = tag_description();
  56. if ( ! empty( $tag_description ) )
  57. echo apply_filters( 'tag_archive_meta', '<div class="taxonomy-description">' . $tag_description . '</div>' );
  58. }
  59. ?>
  60. </header><!-- .page-header -->
  61. <?php waterstreet_content_nav( 'nav-above' ); ?>
  62. <?php /* Start the Loop */ ?>
  63. <?php while ( have_posts() ) : the_post(); ?>
  64. <?php
  65. /* Include the Post-Format-specific template for the content.
  66. * If you want to overload this in a child theme then include a file
  67. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  68. */
  69. get_template_part( 'content', get_post_format() );
  70. ?>
  71. <?php endwhile; ?>
  72. <?php waterstreet_content_nav( 'nav-below' ); ?>
  73. <?php else : ?>
  74. <?php get_template_part( 'no-results', 'archive' ); ?>
  75. <?php endif; ?>
  76. </div><!-- #content .site-content -->
  77. </section><!-- #primary .content-area -->
  78. <?php get_footer(); ?>