PageRenderTime 58ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/archive.php

https://github.com/endter/Touchfolio
PHP | 108 lines | 63 code | 24 blank | 21 comment | 8 complexity | 36fd7554548e17518652a59de76f0175 MD5 | raw file
Possible License(s): GPL-3.0
  1. <?php
  2. /**
  3. * The template for displaying Archive pages.
  4. *
  5. * Learn more: http://codex.wordpress.org/Template_Hierarchy
  6. *
  7. * @package dsframework
  8. * @since dsframework 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', 'dsframework' ), '<span>' . single_cat_title( '', false ) . '</span>' );
  19. } elseif ( is_tag() ) {
  20. printf( __( 'Tag Archives: %s', 'dsframework' ), '<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', 'dsframework' ), '<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', 'dsframework' ), '<span>' . get_the_date() . '</span>' );
  34. } elseif ( is_month() ) {
  35. printf( __( 'Monthly Archives: %s', 'dsframework' ), '<span>' . get_the_date( 'F Y' ) . '</span>' );
  36. } elseif ( is_year() ) {
  37. printf( __( 'Yearly Archives: %s', 'dsframework' ), '<span>' . get_the_date( 'Y' ) . '</span>' );
  38. } else {
  39. _e( 'Archives', 'dsframework' );
  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 dsframework_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 dsframework_content_nav( 'nav-below' ); ?>
  70. <?php else : ?>
  71. <article id="post-0" class="post no-results not-found">
  72. <header class="entry-header">
  73. <h1 class="entry-title"><?php _e( 'Nothing Found', 'dsframework' ); ?></h1>
  74. </header><!-- .entry-header -->
  75. <div class="entry-content">
  76. <p><?php _e( 'It seems we can&rsquo;t find what you&rsquo;re looking for. Perhaps searching can help.', 'dsframework' ); ?></p>
  77. <?php get_search_form(); ?>
  78. </div><!-- .entry-content -->
  79. </article><!-- #post-0 -->
  80. <?php endif; ?>
  81. </div><!-- #content -->
  82. </section><!-- #primary .site-content -->
  83. <?php get_sidebar(); ?>
  84. <?php get_footer(); ?>