PageRenderTime 43ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/archive.php

https://github.com/Darrenmeehan/zomghow-wp-theme
PHP | 99 lines | 55 code | 23 blank | 21 comment | 8 complexity | 3566300b4deb517fc58919da036b6d3e 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 Zomghow
  8. * @since Zomghow 1.0
  9. */
  10. get_header(); ?>
  11. <section id="primary" class="site-content">
  12. <div id="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', 'zomghow' ), '<span>' . single_cat_title( '', false ) . '</span>' );
  19. } elseif ( is_tag() ) {
  20. printf( __( 'Tag Archives: %s', 'zomghow' ), '<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', 'zomghow' ), '<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', 'zomghow' ), '<span>' . get_the_date() . '</span>' );
  34. } elseif ( is_month() ) {
  35. printf( __( 'Monthly Archives: %s', 'zomghow' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
  36. } elseif ( is_year() ) {
  37. printf( __( 'Yearly Archives: %s', 'zomghow' ), '<span>' . get_the_date( 'Y' ) . '</span>' );
  38. } else {
  39. _e( 'Archives', 'zomghow' );
  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>
  57. <?php rewind_posts(); ?>
  58. <?php zomghow_content_nav( 'nav-above' ); ?>
  59. <?php /* Start the Loop */ ?>
  60. <?php while ( have_posts() ) : the_post(); ?>
  61. <?php
  62. /* Include the Post-Format-specific template for the content.
  63. * If you want to overload this in a child theme then include a file
  64. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  65. */
  66. get_template_part( 'content', get_post_format() );
  67. ?>
  68. <?php endwhile; ?>
  69. <?php zomghow_content_nav( 'nav-below' ); ?>
  70. <?php else : ?>
  71. <?php get_template_part( 'no-results', 'archive' ); ?>
  72. <?php endif; ?>
  73. </div><!-- #content -->
  74. </section><!-- #primary .site-content -->
  75. <?php get_sidebar(); ?>
  76. <?php get_footer(); ?>