forked from Tetrakern/fictioneer
-
Notifications
You must be signed in to change notification settings - Fork 0
/
singular-taxonomies.php
142 lines (125 loc) · 3.82 KB
/
singular-taxonomies.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
<?php
/**
* Template Name: Taxonomies
*
* @package WordPress
* @subpackage Fictioneer
* @since 5.0.0
*/
?>
<?php
// Queries
$tags = get_terms(
array(
'taxonomy' => 'post_tag',
'order' => 'asc',
'pad_counts' => true,
'hide_empty' => true
)
);
$genres = get_terms(
array(
'taxonomy' => 'fcn_genre',
'order' => 'asc',
'pad_counts' => true,
'hide_empty' => true
)
);
$fandoms = get_terms(
array(
'taxonomy' => 'fcn_fandom',
'order' => 'asc',
'pad_counts' => true,
'hide_empty' => true
)
);
$characters = get_terms(
array(
'taxonomy' => 'fcn_character',
'order' => 'asc',
'pad_counts' => true,
'hide_empty' => true
)
);
$terms = array(
'tags' => [__( 'Tags', 'fictioneer' ), $tags],
'genres' => [__( 'Genres', 'fictioneer' ), $genres],
'fandoms' => [__( 'Fandoms', 'fictioneer' ), $fandoms],
'characters' => [__( 'Characters', 'fictioneer' ), $characters]
);
?>
<?php get_header(); ?>
<main id="main" class="main singular">
<div class="observer main-observer"></div>
<?php do_action( 'fictioneer_main' ); ?>
<div class="main__background polygon polygon--main background-texture"></div>
<div class="main__wrapper">
<?php do_action( 'fictioneer_main_wrapper' ); ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php
// Inner setup
$title = trim( get_the_title() );
$title = empty( $title ) ? __( 'Taxonomies', 'fictioneer' ) : $title;
$this_breadcrumb = [$title, get_the_permalink()];
?>
<article id="singular-<?php the_ID(); ?>" class="singular__article padding-left padding-right padding-top padding-bottom">
<?php if ( get_the_content() ) : ?>
<section class="singular__content content-section">
<?php the_content(); ?>
</section>
<?php endif; ?>
<?php foreach ( $terms as $tuple ) : ?>
<?php if ( ! is_wp_error( $tuple[1] ) && count( $tuple[1] ) > 0 ) : ?>
<section class="glossary">
<h2><?php echo $tuple[0]; ?></h2>
<div class="glossary__columns">
<?php foreach ( $tuple[1] as $term ) : ?>
<div class="glossary__entry">
<a class="glossary__entry-head" href="<?php echo get_term_link( $term ); ?>">
<div class="glossary__entry-name"><?php echo $term->name; ?></div>
<div class="glossary__entry-count"><?php
printf(
_nx(
'%s Entry',
'%s Entries',
$term->count,
'Taxonomy glossary entry count.',
'fictioneer'
),
$term->count
);
?></div>
</a>
<div class="glossary__entry-body">
<span class="glossary__entry-description"><?php
if ( empty( $term->description ) ) {
_e( 'No description provided yet.' );
} else {
echo $term->description;
}
?></span>
</div>
</div>
<?php endforeach; ?>
</div>
</section>
<?php endif; ?>
<?php endforeach; ?>
</article>
<?php endwhile; ?>
</div>
</main>
<?php
// Footer arguments
$footer_args = array(
'post_type' => 'page',
'post_id' => get_the_ID(),
'breadcrumbs' => array(
[fcntr( 'frontpage' ), get_home_url()]
)
);
// Add current breadcrumb
$footer_args['breadcrumbs'][] = $this_breadcrumb;
// Get footer with breadcrumbs
get_footer( null, $footer_args );
?>