/
index.php
97 lines (67 loc) · 2.13 KB
/
index.php
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
82
83
84
85
86
87
88
89
90
91
92
93
<?php get_header(); ?>
<div class="blog-page">
<div class="posts-container">
<?php global $category_name, $cat; ?>
<?php if(!empty($cat)): ?>
<header>
<h1 class="category-header">Writings on the subject of <em><?php echo $category_name; ?></em></h1>
</header>
<?php endif; ?>
<?php
global $posts_per_page;
if(isset($_GET['page'])):
$currentPage = (int) $_GET['page'];
$offset = ($currentPage - 1) * $posts_per_page;
else:
$currentPage = 1;
endif;
$args = array(
'offset' => $offset,
'cat' => $cat
);
query_posts($args);
while (have_posts()): the_post();
?>
<?php if (has_post_thumbnail()): ?>
<div class="blog-page-excerpt has-thumbnail">
<article>
<div class="header-excerpt-meta-container">
<header>
<h1 class="blog-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
</header>
<footer>
<p class="post-meta"><?php the_time('F jS, Y'); ?> in <?php the_category(' '); ?> <?php comments_number( '', '- 1 comment', '- % comments' ); ?></p>
</footer>
<div class="excerpt-container">
<?php rps_nicer_excerpt(array('words' => 60)); ?>
</div>
</div>
<?php $image = wp_get_attachment_image_src(get_post_thumbnail_id(), 'medium'); ?>
<div class="thumbnail-container">
<a href="<?php the_permalink(); ?>">
<img class="post-thumbnail" src="<?php echo $image[0]; ?>" alt="<?php the_title(); ?>">
</a>
</div>
</article>
</div>
<?php else: //No thumbnail ?>
<div class="blog-page-excerpt no-thumbnail">
<article>
<div class="header-meta-container">
<header>
<h1 class="blog-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
</header>
<footer>
<p class="post-meta"><?php the_time('F jS, Y'); ?> in <?php the_category(' '); ?> <?php comments_number( '', ' - 1 comment', ' - % comments' ); ?></p>
</footer>
</div>
<div class="excerpt-container">
<?php rps_nicer_excerpt(array('words' => 40)); ?>
</div>
</article>
</div>
<?php endif; endwhile; ?>
</div>
<?php rps_pagination(); ?>
</div>
<?php get_footer(); ?>