template-archives.php 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159
  1. <?php
  2. /*
  3. Template Name: Archive template
  4. */
  5. ?>
  6. <?php get_header(); ?>
  7. <div class="wrapper section-inner">
  8. <div class="content left">
  9. <div class="posts">
  10. <div class="post">
  11. <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
  12. <?php if ( has_post_thumbnail() ) : ?>
  13. <div class="featured-media">
  14. <a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php the_title(); ?>">
  15. <?php the_post_thumbnail('post-image'); ?>
  16. <?php if ( !empty(get_post(get_post_thumbnail_id())->post_excerpt) ) : ?>
  17. <div class="media-caption-container">
  18. <p class="media-caption"><?php echo get_post(get_post_thumbnail_id())->post_excerpt; ?></p>
  19. </div>
  20. <?php endif; ?>
  21. </a>
  22. </div> <!-- /featured-media -->
  23. <?php endif; ?>
  24. <div class="post-header">
  25. <h2 class="post-title"><?php the_title(); ?></h2>
  26. </div> <!-- /post-header -->
  27. <div class="post-content">
  28. <?php the_content(); ?>
  29. <div class="archive-box">
  30. <div class="archive-col">
  31. <h3><?php _e('Last 30 Posts', 'hemingway') ?></h3>
  32. <ul>
  33. <?php $archive_30 = get_posts('numberposts=30');
  34. foreach($archive_30 as $post) : ?>
  35. <li>
  36. <a href="<?php the_permalink(); ?>">
  37. <?php the_title();?>
  38. <span>(<?php the_time(get_option('date_format')); ?>)</span>
  39. </a>
  40. </li>
  41. <?php endforeach; ?>
  42. </ul>
  43. <h3><?php _e('Archives by Categories', 'hemingway') ?></h3>
  44. <ul>
  45. <?php wp_list_categories( 'title_li=', 'hemingway' ); ?>
  46. </ul>
  47. <h3><?php _e('Archives by Tags', 'hemingway') ?></h3>
  48. <ul>
  49. <?php $tags = get_tags();
  50. if ($tags) {
  51. foreach ($tags as $tag) {
  52. echo '<li><a href="' . get_tag_link( $tag->term_id ) . '" title="' . sprintf( __( "View all posts in %s", 'hemingway' ), $tag->name ) . '" ' . '>' . $tag->name.'</a></li> ';
  53. }
  54. }
  55. wp_reset_query();?>
  56. </ul>
  57. </div> <!-- /archive-col -->
  58. <div class="archive-col">
  59. <h3><?php _e('Contributors', 'hemingway') ?></h3>
  60. <ul>
  61. <?php wp_list_authors(); ?>
  62. </ul>
  63. <h3><?php _e('Archives by Year', 'hemingway') ?></h3>
  64. <ul>
  65. <?php wp_get_archives('type=yearly'); ?>
  66. </ul>
  67. <h3><?php _e('Archives by Month', 'hemingway') ?></h3>
  68. <ul>
  69. <?php wp_get_archives('type=monthly'); ?>
  70. </ul>
  71. <h3><?php _e('Archives by Day', 'hemingway') ?></h3>
  72. <ul>
  73. <?php wp_get_archives('type=daily'); ?>
  74. </ul>
  75. </div> <!-- /archive-col -->
  76. <div class="clear"></div>
  77. </div> <!-- /archive-box -->
  78. <?php if ( current_user_can( 'manage_options' ) ) : ?>
  79. <p><?php edit_post_link( __('Edit', 'hemingway') ); ?></p>
  80. <?php endif; ?>
  81. </div> <!-- /post-content -->
  82. <div class="clear"></div>
  83. <?php if ( comments_open() ) : ?>
  84. <?php comments_template( '', true ); ?>
  85. <?php endif; ?>
  86. <?php endwhile; else: ?>
  87. <p><?php _e("We couldn't find any posts that matched your query. Please try again.", "hemingway"); ?></p>
  88. <?php endif; ?>
  89. </div> <!-- /post -->
  90. </div> <!-- /posts -->
  91. </div> <!-- /content -->
  92. <?php get_sidebar(); ?>
  93. <div class="clear"></div>
  94. </div> <!-- /wrapper section-inner -->
  95. <?php get_footer(); ?>