-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive.php
144 lines (130 loc) · 5.46 KB
/
archive.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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
<?php
if (!defined('ABSPATH')) exit;
get_header(vibe_get_header());
$page_id = get_the_ID();
?>
<section class="blogSectionTop">
<div class="container">
<div class="row">
<div class="col-md-12 col-sm-12 col-xs-12">
<?php vibe_breadcrumbs(); ?>
<h2><?php
if (is_month()) {
single_month_title(' ');
} elseif (is_year()) {
echo get_the_time('Y');
} else if (is_category()) {
echo single_cat_title();
} else if (is_tag()) {
single_tag_title();
} else {
post_type_archive_title();
}
?></h2>
<p><?php echo term_description(); ?></p>
</div>
</div>
</div>
</section>
<section class="blogSectionMiddle">
<div class="container">
<div class="row">
<div class="col-md-9 col-sm-8 col-xs-12">
<div class="theBlogContentBox">
<div class="row">
<?php
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$current_category = get_queried_object();
$current_category_id = $current_category->term_id;
$args = array(
'post_type' => 'post',
'post_status' => 'publish',
'posts_per_page' => 6,
'post__not_in' => array(get_the_ID()),
'cat' => $current_category_id,
'paged' => $paged
);
$loop = new WP_Query($args);
while ($loop->have_posts()) : $loop->the_post();
$blogID = get_the_ID();
?>
<div class="col-md-4 col-sm-6 col-xs-12">
<div class="theSingleBox">
<a href="<?php the_permalink(); ?>"><img src="<?php echo get_the_post_thumbnail_url($blogID, 'small'); ?>" alt="blogImg"></a>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<span><?php echo get_the_date(); ?></span>
</div>
</div>
<?php
endwhile;
wp_reset_postdata();
?>
</div>
<!-- Pagination -->
<div class="paginationadamsblog">
<?php
echo paginate_links(array(
'total' => $loop->max_num_pages,
'prev_text' => __('<'),
'next_text' => __('>'),
));
?>
</div>
<!-- End Pagination -->
</div>
</div>
<div class="col-md-3 col-sm-4 col-xs-12">
<div class="newSideBarDiv">
<div class="blogCategories">
<?php
$categories = get_categories(array(
'post_type' => 'post',
'orderby' => 'name',
'order' => 'ASC'
));
?>
<h2>Categories</h2>
<ul>
<?php
foreach ($categories as $category) {
?>
<li><a href="<?php echo get_category_link($category->term_id); ?>"><?php echo $category->name; ?></a></li>
<?php
}
?>
</ul>
</div>
<hr>
<div class="recentBlogs">
<h2>Recent Posts</h2>
<?php
$recent_args = array(
'post_type' => 'post',
"posts_per_page" => 5,
"orderby" => "date",
"order" => "DESC"
);
$recent_posts = new WP_Query($recent_args);
while ($recent_posts->have_posts()) : $recent_posts->the_post();
$blogID = get_the_ID();
?>
<a href="<?php the_permalink(); ?>">
<img src="<?php echo get_the_post_thumbnail_url($blogID, 'small'); ?>" alt="recentblogs">
<div class="informationdive">
<h6><?php the_title(); ?></h6>
<span><?php echo get_the_date(); ?></span>
</div>
</a>
<?php
endwhile;
wp_reset_postdata();
?>
</div>
</div>
</div>
</div>
</div>
</section>
<?php
get_footer(vibe_get_footer());
?>