-
Notifications
You must be signed in to change notification settings - Fork 0
/
archive.php
120 lines (88 loc) · 2.95 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
<?php
/**
* The template for displaying Archive pages.
*
* Used to display archive-type pages if nothing more specific matches a query.
* For example, puts together date-based pages if no date.php file exists.
*
* If you'd like to further customize these archive views, you may create a
* new template file for each specific one. For example, Outspoken
* already has tag.php for Tag archives, category.php for Category archives,
* and author.php for Author archives.
*
* Learn more: http://codex.wordpress.org/Template_Hierarchy
*/
get_header(); ?>
<div id="primary" class="content-area">
<div id="content" class="site-content" role="main">
<?php if (have_posts()): ?>
<?php
$headr_open = '<h1 class="archive-title">';
$headr_close = '</h1>';
// $current_term = single_term_title("", false);
$queried_object = get_queried_object();
// echo '<pre>';
// var_dump( $queried_object );
// echo '</pre>';
?>
<header class="archive-header">
<h1 class="archive-title"><?php
if (is_day()):
printf(__('Daily Archives: %s', 'outspoken'), get_the_date());
elseif (is_month()):
printf(__('Monthly Archives: %s', 'outspoken'), get_the_date(_x('F Y', 'monthly archives date format', 'outspoken')));
elseif (is_year()):
printf(__('Yearly Archives: %s', 'outspoken'), get_the_date(_x('Y', 'yearly archives date format', 'outspoken')));
elseif (is_tax()):
$tax_slug = $queried_object->taxonomy;
$tax_info = get_taxonomy( $tax_slug );
// print_r($tax_info);
echo $tax_info->singular_label;
echo ': ';
single_term_title();
else:
_e('Archives', 'outspoken');
endif;
?></h1>
</header><!-- .archive-header -->
<?php
/*
* Show taxonomy description
* and custom meta
*/
$term_id = $queried_object->term_id;
$term_description = $queried_object->description;
// check for the length of $term_description
// Use multi-column only for long descriptions.
$infobox_class = "infobox-short";
if (strlen($term_description)>400) {
$infobox_class = "infobox-medium";
}
if (strlen($term_description)>800) {
$infobox_class = "infobox-long";
}
if (!empty($term_description)) {
echo '<div class="infobox '.$infobox_class.'">';
echo apply_filters( 'the_content', $term_description );
echo '</div>';
}
if ( is_tax() ) {
// Show number of found items:
echo '<div class="films-found"><h2>';
echo 'Films found / nombre de films: ';
echo $queried_object->count;
echo '</h2></div>';
}
?>
<?php /* The loop */ ?>
<?php while (have_posts()): the_post(); ?>
<?php get_template_part('content', get_post_format()); ?>
<?php endwhile; ?>
<?php outspoken_paging_nav(); ?>
<?php else: ?>
<?php get_template_part('content', 'none'); ?>
<?php endif; ?>
</div><!-- #content -->
</div><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>