-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharchive.php
More file actions
81 lines (68 loc) · 2.88 KB
/
archive.php
File metadata and controls
81 lines (68 loc) · 2.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/*
The template that runs all date, author, category & tag archive pages.
*/
get_header(); ?>
<div class="jumbotron">
<div class="container">
<?php $post = $posts[0]; // Set $post so that the_date() works. ?>
<?php /* Category Archives */ if (is_category()) { ?>
<h1>Category: <?php single_cat_title(); ?></h1>
<div class="row">
<div class="col-md-8"><?php echo category_description(); ?></div>
</div>
<?php /* Tag Archives */ } elseif( is_tag() ) { ?>
<h1>Tagged: <?php single_tag_title(); ?></h1>
<div class="row">
<div class="col-md-8"><?php echo tag_description(); ?></div>
</div>
<?php /* Date Archive -> DAY */ } elseif (is_day()) { ?>
<h1>Articles from <?php the_date(); ?></h1>
<?php /* Date Archive -> MONTH */ } elseif (is_month()) { ?>
<h1>Articles from <?php the_time('F Y'); ?></h1>
<?php /* Date Archive -> YEAR */ } elseif (is_year()) { ?>
<h1>Articles from <?php the_time('Y'); ?></h1>
<?php /* If this is an author archive */ } elseif (is_author()) {
$curauth = (isset($_GET['author_name'])) ? get_user_by('slug', $author_name) : get_userdata(intval($author)); ?>
<h1>Author: <?php echo $curauth->display_name; ?></h1>
<?php /* Paged Archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?>
<h1>Archives</h1>
<?php } ?>
</div> <!-- .container -->
</div> <!-- .jumbotron -->
<div class="container" id="main">
<div class="row">
<div class="col-md-8">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<article <?php post_class('media'); ?>>
<a class="pull-left" href="<?php the_permalink(); ?>">
<?php // Insert featured image
if (has_post_thumbnail()) {
echo get_the_post_thumbnail($post->ID, 'thumbnail', array('class' => 'media-object', 'title' => '', 'alt' => 'alttag' ));
} else { // Use a fallback ?>
<img class="media-object" src="http://placehold.it/120x120" alt="No Image" />
<?php } ?>
</a>
<div class="media-body">
<h2 class="media-heading" id="post-<?php the_ID(); ?>"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p><?php echo wp_trim_words( get_the_excerpt(), 30, '...' ); ?></p>
</div> <!-- .media-body -->
</article> <!-- .media -->
<hr />
<?php endwhile; ?>
<ul class="pager">
<li><?php next_posts_link('<i class="fa-chevron-left"></i> Older Articles') ?></li>
<li><?php previous_posts_link('Newer Articles <i class="fa-chevron-right"></i>') ?></li>
</ul>
<?php else : // If no posts are found ?>
<article>
<h2><?php _e('Nothing Found'); ?></h2>
<p><?php _e('Sorry, but we couldn’t find any articles of that type. Try searching for one.'); ?></p>
<?php get_search_form(); ?>
</article>
<?php endif; ?>
</div> <!-- .col-md-8 -->
<?php get_sidebar(); ?>
</div> <!-- .row -->
</div><!-- .container -->
<?php get_footer(); ?>