PageRenderTime 53ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/archive.php

https://github.com/chiqui3d/Tanlinell
PHP | 99 lines | 54 code | 24 blank | 21 comment | 8 complexity | 2581a840904b40faad83ddfc7242fa39 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 Tanlinell
  8. * @since Tanlinell 1.0
  9. */
  10. get_header(); ?>
  11. <div class="main" 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', 'tanlinell' ), '<span>' . single_cat_title( '', false ) . '</span>' );
  18. } elseif ( is_tag() ) {
  19. printf( __( 'Tag Archives: %s', 'tanlinell' ), '<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', 'tanlinell' ), '<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>' );
  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', 'tanlinell' ), '<span>' . get_the_date() . '</span>' );
  33. } elseif ( is_month() ) {
  34. printf( __( 'Monthly Archives: %s', 'tanlinell' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
  35. } elseif ( is_year() ) {
  36. printf( __( 'Yearly Archives: %s', 'tanlinell' ), '<span>' . get_the_date( 'Y' ) . '</span>' );
  37. } else {
  38. _e( 'Archives', 'tanlinell' );
  39. }
  40. ?>
  41. </h1>
  42. <?php
  43. if ( is_category() ) {
  44. // show an optional category description
  45. $category_description = category_description();
  46. if ( ! empty( $category_description ) )
  47. echo apply_filters( 'category_archive_meta', '<div class="taxonomy-description">' . $category_description . '</div>' );
  48. } elseif ( is_tag() ) {
  49. // show an optional tag description
  50. $tag_description = tag_description();
  51. if ( ! empty( $tag_description ) )
  52. echo apply_filters( 'tag_archive_meta', '<div class="taxonomy-description">' . $tag_description . '</div>' );
  53. }
  54. ?>
  55. </header><!-- .page-header -->
  56. <?php tanlinell_content_nav( 'nav-above' ); ?>
  57. <?php /* Start the Loop */ ?>
  58. <?php while ( have_posts() ) : the_post(); ?>
  59. <?php
  60. /* Include the Post-Format-specific template for the content.
  61. * If you want to overload this in a child theme then include a file
  62. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  63. */
  64. get_template_part( 'content', get_post_format() );
  65. ?>
  66. <?php endwhile; ?>
  67. <?php tanlinell_content_nav( 'nav-below' ); ?>
  68. <?php else : ?>
  69. <?php get_template_part( 'no-results', 'archive' ); ?>
  70. <?php endif; ?>
  71. </div><!-- .main -->
  72. <div class="sub">
  73. <?php get_sidebar(); ?>
  74. </div>
  75. <?php get_footer(); ?>