PageRenderTime 51ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/archive.php

https://github.com/blackandblack/bb_boilerplate
PHP | 50 lines | 24 code | 0 blank | 26 comment | 3 complexity | 22dd6633df5f3bebf2e22c046de87fd2 MD5 | raw file
Possible License(s): MIT
  1. <?php
  2. /**
  3. * The template for displaying Archive pages.
  4. *
  5. * Used to display archive-type pages if nothing more specific matches a query.
  6. * For example, puts together date-based pages if no date.php file exists.
  7. *
  8. * Learn more: http://codex.wordpress.org/Template_Hierarchy
  9. *
  10. * @package WordPress
  11. * @subpackage Boilerplate
  12. * @since Boilerplate 1.0
  13. */
  14. include_once 'includes.php';
  15. get_header(); ?>
  16. <?php
  17. /* Queue the first post, that way we know
  18. * what date we're dealing with (if that is the case).
  19. *
  20. * We reset this later so we can run the loop
  21. * properly with a call to rewind_posts().
  22. */
  23. if ( have_posts() )
  24. the_post();
  25. ?>
  26. <h1 class="page-title"><?php
  27. if ( is_day() ) :
  28. printf( __( 'Daily Archives: %s', 'boilerplate' ), get_the_date() );
  29. elseif ( is_month() ) :
  30. printf( __( 'Monthly Archives: %s', 'boilerplate' ), get_the_date('F Y') );
  31. elseif ( is_year() ) :
  32. printf( __( 'Yearly Archives: %s', 'boilerplate' ), get_the_date('Y') );
  33. else :
  34. _e( 'Blog Archives', 'boilerplate' );
  35. endif;
  36. ?></h1>
  37. <?php
  38. /* Since we called the_post() above, we need to
  39. * rewind the loop back to the beginning that way
  40. * we can run the loop properly, in full.
  41. */
  42. rewind_posts();
  43. /* Run the loop for the archives page to output the posts.
  44. * If you want to overload this in a child theme then include a file
  45. * called loop-archives.php and that will be used instead.
  46. */
  47. get_template_part( 'loop', 'archive' );
  48. ?>
  49. <?php get_sidebar(); ?>
  50. <?php get_footer(); ?>