forked from Frumph/comicpress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patharchive.php
225 lines (175 loc) · 5.8 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
224
225
<?php
/**
* Archiv Page
* by Philip M. Hofer (Frumph)
* http://frumph.net/
*
* Content for the Archiv page.
*
* @package Comicpress
*/
get_header();
do_action( 'comic-blog-area' );
// Set to empty.
$count = $theCatID = '';
if ( is_category() ) {
$theCatID = get_term_by( 'slug', $wp_query->query_vars['category_name'], 'category' );
if ( ! empty( $theCatID ) )
$theCatID = $theCatID->term_id;
if ( isset( $wp_query->query_vars['cat'] ) ) $theCatID = (int) $wp_query->query_vars['cat'];
}
$count = $wp_query->found_posts;
if ( empty( $count ) ) $count = 'No';
$title_string = '';
if ( $count > 0 ) {
if ( is_category() ) { /* Category */
$title_string = __( 'Archive for', 'comicpress' ) . ' ' . single_cat_title( '', false );
} elseif ( is_tag() ) { /* Tag */
$title_string = __( 'Posts Tagged', 'comicpress' ) . ' ' . single_tag_title( '', false );
} elseif ( is_day() ) {
$title_string = __( 'Archive for', 'comicpress' ) . ' ' . get_the_time( 'F jS, Y' ) . ' ';
} elseif ( is_month() ) {
$title_string = __( 'Archive for', 'comicpress' ) . ' ' . get_the_time( 'F, Y' );
} elseif ( is_year() ) {
$title_string = __( 'Archive for', 'comicpress' ) . ' ' . get_the_time( 'Y' );
} elseif ( is_author() ) {
$title_string = __( 'Author Archive', 'comicpress' ) . ' ' . get_the_time( 'Y' );
} elseif ( isset( $_GET['paged'] ) && ! empty( $_GET['paged'] ) ) {
$title_string = __( 'Archives', 'comicpress' );
} elseif ( isset( $wp_query->query_vars['taxonomy'] ) && taxonomy_exists( $wp_query->query_vars['taxonomy'] ) ) {
$taxonomy_name = '';
if ( isset( $wp_query->query_vars['chapters'] ) ) {
$taxonomy_name = get_term_by( 'slug', $wp_query->query_vars['chapters'], 'chapters' );
if ( ! is_wp_error( $taxonomy_name ) && ! empty( $taxonomy_name ) ) $title_string = $taxonomy_name->name;
} elseif ( isset( $wp_query->query_vars['locations'] ) ) {
$taxonomy_name = get_term_by( 'slug', $wp_query->query_vars['locations'], 'locations' );
if ( ! is_wp_error( $taxonomy_name ) && ! empty( $taxonomy_name ) ) $title_string = $taxonomy_name->name;
} elseif ( term_exists( $wp_query->query_vars['term'] ) ) {
$title_string = __( 'Archive for', 'comicpress' ) . ' ' . $wp_query->query_vars['term'];
} else {
$title_string = __( 'Archive for', 'comicpress' ) . ' ' . $wp_query->query_vars['taxonomy'];
}
} elseif ( $wp_query->query_vars['post_type'] !== 'post' ) {
$title_string = __( 'Archive for', 'comicpress' ) . ' ' . $wp_query->query_vars['post_type'];
} else {
$title_string = __( 'Archive is unable to be found.', 'comicpress' );
}
} else $title_string = __( 'No Archive Found.', 'comicpress' );
if ( have_posts() ) {
?>
<h2 class="page-title">
<?php echo esc_html( $title_string ); ?>
</h2>
<?php
if ( isset( $wp_query->query_vars['chapters'] ) || ( $wp_query->query_vars['post_type'] == 'comic' ) ) {
?>
<div class="archiveresults">
<?php
printf(
/* translators: %d: Number of found comic */
esc_html( _n( '%d comic', '%d comics', $count, 'comicpress' ) ),
esc_html( $count )
);
?>
</div>
<?php
} else {
?>
<div class="archiveresults">
<?php
printf(
/* translators: %d: Number of found results */
esc_html( _n( '%d result', '%d results', $count, 'comicpress' ) ),
esc_html( $count )
);
?>
</div>
<?php
}
?>
<div class="clear"></div>
<?php
if ( function_exists( 'ceo_pluginfo' ) && ( isset( $wp_query->query_vars['chapters'] ) || isset( $wp_query->query_vars['characters'] ) || isset( $wp_query->query_vars['locations'] ) || ( $wp_query->query_vars['post_type'] == 'comic' ) ) && ( comicpress_themeinfo( 'display_archive_as_links' ) && ! comicpress_is_bbpress() ) ) {
while ( have_posts() ) :
the_post();
?>
<div class="archivecomicthumbwrap">
<div class="archivecomicthumbdate">
<?php echo esc_html( get_the_time( _x( 'M jS, Y', 'comic archives date format', 'comicpress' ) ) ); ?>
</div>
<div class="archivecomicframe">
<?php
$thumbnail = ceo_display_comic_thumbnail( 'thumbnail', $post );
$thumbnail = ( ! $thumbnail ) ? __( 'No Thumbnail or Featured Image Found.', 'comicpress' ) : $thumbnail;
?>
<a href="<?php the_permalink(); ?>" title="<?php echo the_title(); ?>">
<?php echo $thumbnail; ?>
</a>
<br />
</div>
</div>
<?php
endwhile;
} elseif ( comicpress_themeinfo( 'display_archive_as_links' ) || comicpress_is_bbpress() ) {
?>
<div <?php post_class(); ?>>
<div class="post-head"></div>
<div class="entry">
<table class="archive-table">
<?php
while ( have_posts() ) :
the_post();
?>
<tr>
<td class="archive-date">
<span class="archive-date-month-day">
<?php the_time( _x( 'M d, ', 'archive table monthly date format', 'comicpress' ) ); ?>
</span>
<span class="archive-date-year">
<?php the_time( _x( 'Y', 'archive table yearly date format', 'comicpress' ) ); ?>
</span>
</td>
<td class="archive-title">
<a href="<?php echo esc_html( get_permalink( $post->ID ) ); ?>" rel="bookmark" title="<?php esc_html_e( 'Permanent Link:', 'comicpress' ); ?> <?php the_title(); ?>">
<?php the_title(); ?>
</a>
</td>
</tr>
<?php
endwhile;
?>
</table>
</div>
<div class="post-foot"></div>
</div>
<?php
} else {
while ( have_posts() ) :
the_post();
$post_format = ( $post->post_type !== 'post' ) ? $post->post_type : get_post_format();
get_template_part( 'content', $post_format );
endwhile;
}
?>
<div class="clear"></div>
<?php
comicpress_pagination();
} else {
?>
<h2 class="page-title">
<?php echo esc_html( $title_string ); ?>
</h2>
<div class="archiveresults">
<?php
printf(
/* translators: %d: Number of found results */
esc_html( _n( '%d result', '%d results', $count, 'comicpress' ) ),
esc_html( $count )
);
?>
</div>
<div class="clear"></div>
<?php
}
get_footer();
?>