forked from lichifeng/goule
-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive.php
223 lines (205 loc) · 9.33 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
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
<?php
/*
Template Name: Archives
*/
get_header();
?>
<div id="primary" class="content-area">
<?php get_template_part('index',
'nav'
); ?>
<?php if (is_page()): ?>
<main id="main" class="container-fluid">
<div class="archive-row">
<div class="row no-gutter">
<div class="col-xs-12 archive-title">
<span class="glyphicon glyphicon-tag"
aria-hidden="true"></span>
<?php esc_html_e("Browse by Tags",
'goule'
); ?>
</div>
</div>
<div class="row no-gutter tag-cloud">
<ul class="pager">
<li>
<?php
$t_cloud = wp_tag_cloud(array(
'smallest' => 0.8,
'largest' => 2,
'unit' => 'em',
'format' => 'array',
'number' => 100,
)
);
echo join("</li><li>",
$t_cloud
);
?>
</li>
</ul>
</div>
</div>
<div class="archive-row">
<div class="row no-gutter">
<div class="col-xs-12 archive-title">
<span class="glyphicon glyphicon-list"
aria-hidden="true"></span>
<?php esc_html_e("Browse by Categorys",
'goule'
); ?>
</div>
</div>
<div class="row no-gutter archive-list">
<?php
$categories = get_categories(array(
'orderby' => 'name',
'order' => 'ASC',
)
);
foreach (
$categories
as
$category
)
{
$category_link = sprintf('<a href="%1$s" title="%2$s">%3$s</a>',
esc_url(get_category_link($category->term_id
)
),
esc_attr(sprintf(__('View all posts in %s',
'goule'
),
$category->name
)
),
esc_html($category->name)
);
echo '<div class="col-md-4 text-center">' . $category_link . ' (' . $category->count . ')</div>';
}
?>
</div>
</div>
<div class="archive-row">
<div class="row no-gutter">
<div class="col-xs-12 archive-title">
<span class="glyphicon glyphicon-calendar"
aria-hidden="true"></span>
<?php esc_html_e("Browse by Date",
'goule'
); ?>
</div>
</div>
<div class="row no-gutter archive-list">
<?php
$args = array(
'type' => 'monthly',
'show_post_count' => 1,
'format' => 'custom',
'before' => '<div class="col-md-3 text-center">',
'after' => '</div>',
);
wp_get_archives($args);
?>
</div>
</div>
<div class="archive-row">
<div class="row no-gutter">
<div class="col-xs-12 archive-title">
<span class="glyphicon glyphicon-duplicate"
aria-hidden="true"></span>
<?php _e("Page list",
'goule'
); ?>
</div>
</div>
<div class="row no-gutter archive-list">
<?php
$pages = get_pages();
foreach (
$pages
as
$page
)
{
$option = '<div class="col-md-6"><a href="' . get_page_link($page->ID
) . '">';
$option .= $page->post_title;
$option .= '</a></div>';
echo $option;
}
?>
</div>
</div>
<div class="archive-row">
<div class="row no-gutter">
<div class="col-xs-12 archive-title">
<span class="glyphicon glyphicon-picture"
aria-hidden="true"></span>
<?php esc_html_e("Attachment list",
'goule'
); ?>
</div>
</div>
<div class="row no-gutter archive-list">
<?php
$attachments = get_posts(array(
'post_type' => 'attachment',
'orderby' => 'post__in',
)
);
if ($attachments) {
foreach (
$attachments
as
$attachment
)
{
$attachment_page = get_attachment_link($attachment->ID
);
?>
<div class="col-xs-4">
<a href="<?php echo $attachment_page; ?>"><?php echo get_the_title($attachment->ID
); ?></a>
</div>
<?php
}
}
?>
</div>
</div>
</main><!-- .site-main -->
<?php else: ?>
<main id="main">
<?php if (have_posts()) :
// Start the loop.
while (have_posts()) : the_post();
/*
* Include the Post-Format-specific template for the content.
* If you want to override this in a child theme, then include a file
* called content-___.php (where ___ is the Post Format name) and that will be used instead.
*/
get_template_part('content',
get_post_format()
);
// End the loop.
endwhile;
// If no content, include the "No posts found" template.
else :
get_template_part('content',
'none'
);
endif;
$pagination_args = array(
'prev_text' => '<span aria-hidden="true">«</span>',
'next_text' => '<span aria-hidden="true">»</span>',
'type' => 'list',
)
?>
<nav class="wp-pagenavi">
<?php echo theme_paginate_links($pagination_args); ?>
</nav>
</main><!-- .site-main -->
<?php endif; ?>
</div><!-- .content-area -->
<?php get_footer(); ?>