/
index.php
executable file
·110 lines (71 loc) · 2.86 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
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php get_header(); ?>
<div class="content">
<?php
$paged = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;
$archive_title = '';
$archive_subtitle = '';
$by_collector = false;
if ( is_archive() ) {
$archive_title = $wp_query->found_posts . ' ' . get_the_archive_title();
} elseif ( is_search() ) {
$archive_title = sprintf(
_n(
'%s ' . ucfirst(get_trucollector_collection_single_item()) . ' found for "%s"',
'%s ' . ucfirst(get_trucollector_collection_plural_item()) . ' found for "%s"',
$wp_query->found_posts,
'fukasawa'
),
number_format_i18n( $wp_query->found_posts ),
get_search_query());
} elseif (get_query_var('collector')) {
if ( $wp_query->found_posts == 1) {
//get the plural right, yes this is the lazy way
$archive_title = $wp_query->found_posts . ' ' . get_trucollector_collection_single_item() . ' collected by: ' . urldecode(get_query_var('collector'));
} else {
$archive_title = $wp_query->found_posts . ' ' . get_trucollector_collection_plural_item() . ' collected by: ' . urldecode(get_query_var('collector'));
}
$by_collector = true;
} elseif ( $paged > 1 ) {
$archive_title = sprintf( __( ' (page %1$s of %2$s)', 'fukasawa' ), $paged, $wp_query->max_num_pages );
}
if ( ( is_archive() || is_search() || $by_collector ) && 1 < $wp_query->max_num_pages ) {
$archive_subtitle = sprintf( __( ' (page %1$s of %2$s)', 'fukasawa' ), $paged, $wp_query->max_num_pages );
}
$archive_description = get_the_archive_description();
if ( $archive_title ) : ?>
<div class="page-title">
<div class="section-inner clear">
<h1 class="archive-title">
<?php
echo $archive_title;
if ( $archive_subtitle ) {
echo '<span class="archive-subtitle">' . $archive_subtitle . '</span>';
}
?>
</h1>
<?php if ( $archive_description ) : ?>
<div class="archive-description">
<?php echo wp_kses_post( wpautop( $archive_description ) ); ?>
</div><!-- .archive-description -->
<?php endif; ?>
</div><!-- .section-inner -->
</div><!-- .page-title -->
<?php endif; ?>
<?php if ( have_posts() ) : ?>
<div class="posts" id="posts">
<?php
while ( have_posts() ) : the_post();
$template_part_name = get_post_type() == 'post' ? get_post_format() : get_post_type();
get_template_part( 'content', $template_part_name );
endwhile;
?>
</div><!-- .posts -->
<?php get_template_part( 'pagination' ); ?>
<?php elseif ( is_search() ) : ?>
<div class="post-content">
<p><?php _e( "No results found for your search. You can give it another try through the form below.", 'fukasawa' ); ?></p>
<?php get_search_form(); ?>
</div><!-- .post-content -->
<?php endif; ?>
</div><!-- .content -->
<?php get_footer(); ?>