PageRenderTime 35ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/archive.php

https://github.com/tiborp/_bootstraps
PHP | 87 lines | 54 code | 12 blank | 21 comment | 8 complexity | f248ee2966c7e2b74c247d59196e5e56 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 _bootstraps
  8. * @package _bootstraps - 2013 1.0
  9. */
  10. get_header();
  11. ?>
  12. <section id="primary" class="content-area span8">
  13. <div id="content" class="site-content" role="main">
  14. <?php if ( have_posts() ) : ?>
  15. <header class="page-header">
  16. <h1 class="page-title">
  17. <?php
  18. if ( is_category() ) {
  19. printf( __( 'Category Archives: %s', 'wedevs' ), '<span>' . single_cat_title( '', false ) . '</span>' );
  20. } elseif ( is_tag() ) {
  21. printf( __( 'Tag Archives: %s', 'wedevs' ), '<span>' . single_tag_title( '', false ) . '</span>' );
  22. } elseif ( is_author() ) {
  23. /* Queue the first post, that way we know
  24. * what author we're dealing with (if that is the case).
  25. */
  26. the_post();
  27. printf( __( 'Author Archives: %s', 'wedevs' ), '<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>' );
  28. /* Since we called the_post() above, we need to
  29. * rewind the loop back to the beginning that way
  30. * we can run the loop properly, in full.
  31. */
  32. rewind_posts();
  33. } elseif ( is_day() ) {
  34. printf( __( 'Daily Archives: %s', 'wedevs' ), '<span>' . get_the_date() . '</span>' );
  35. } elseif ( is_month() ) {
  36. printf( __( 'Monthly Archives: %s', 'wedevs' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
  37. } elseif ( is_year() ) {
  38. printf( __( 'Yearly Archives: %s', 'wedevs' ), '<span>' . get_the_date( 'Y' ) . '</span>' );
  39. } else {
  40. _e( 'Archives', 'wedevs' );
  41. }
  42. ?>
  43. </h1>
  44. <?php
  45. if ( is_category() ) {
  46. // show an optional category description
  47. $category_description = category_description();
  48. if ( !empty( $category_description ) )
  49. echo apply_filters( 'category_archive_meta', '<div class="taxonomy-description">' . $category_description . '</div>' );
  50. } elseif ( is_tag() ) {
  51. // show an optional tag description
  52. $tag_description = tag_description();
  53. if ( !empty( $tag_description ) )
  54. echo apply_filters( 'tag_archive_meta', '<div class="taxonomy-description">' . $tag_description . '</div>' );
  55. }
  56. ?>
  57. </header><!-- .page-header -->
  58. <?php /* Start the Loop */ ?>
  59. <?php while (have_posts()) : the_post(); ?>
  60. <?php
  61. /* Include the Post-Format-specific template for the content.
  62. * If you want to overload this in a child theme then include a file
  63. * called content-___.php (where ___ is the Post Format name) and that will be used instead.
  64. */
  65. get_template_part( 'content', get_post_format() );
  66. ?>
  67. <?php endwhile; ?>
  68. <?php wedevs_content_nav( 'nav-below' ); ?>
  69. <?php else : ?>
  70. <?php get_template_part( 'no-results', 'archive' ); ?>
  71. <?php endif; ?>
  72. </div><!-- #content .site-content -->
  73. </section><!-- #primary .content-area -->
  74. <?php get_sidebar(); ?>
  75. <?php get_footer(); ?>