-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsingle-novel.php
133 lines (122 loc) · 6.5 KB
/
single-novel.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
<?php
/**
* Novel template
*
* @package LNarchive
*/
get_header();
$the_post = get_post();
$the_post_id = get_the_ID();
$the_post_title = get_the_title();
?>
<main id="main" class="main-content" role="main">
<div id="<?php echo esc_attr($the_post_id);?>" class="row main-row">
<div class="novel-wrap">
<?php
if( have_posts() ) {
while( have_posts( )) : the_post();
printf(
'<h1 id="page-title">%1$s</h1>',
wp_kses_post($the_post_title),
);
?>
<section id="info-section">
<div class="row novel-row">
<div class="novel-info-left col-lg-4 col-md-4 col-sm-12 col-12">
<div id="volume-cover">
<?php
the_post_custom_thumbnail(
$the_post_id,
'novel-cover',
[
'class' => 'novel-cover',
'alt' => esc_html($the_post_title),
]
);
?>
</div>
<table>
<?php
$taxs = get_object_taxonomies('novel', 'names');
foreach( $taxs as $tax) {
if(get_option('novel-display-'.$tax)) {
$terms = get_the_terms($the_post_id, $tax);
if( is_array($terms)){
$tax_label_name = esc_html(get_taxonomy_labels(get_taxonomy($tax))->name);
?>
<tr id="<?php echo $tax_label_name.'_row'?>">
<th><?php
echo $tax_label_name;
?>
</th>
<td id="<?php echo esc_attr($tax).'_info_value';?>">
<?php
foreach( $terms as $key => $article_term) {
?>
<a href="<?php echo esc_attr(get_post_type_archive_link('novel')).'?'.$tax.'_filter'.'='.$article_term->term_id?>"><?php echo esc_html($article_term->name)?></a>
<br>
<?php
}
?>
</td>
</tr>
<?php
}
}
}
?>
<tbody id="volume-info"></tbody>
</table>
</div>
<div class="novel-info-right col">
<div id="novel-actions"></div>
<div id="volume-desc"></div>
<div id="formats-list"></div>
<?php
$alt_names = get_post_meta( $the_post_id, 'alternate_names_value', true );
$alt_names_array = explode( ",", $alt_names );
if( !empty( $alt_names_array[0] )){
?>
<h4>Alternate Names</h4>
<p>
<?php
foreach( $alt_names_array as $alt) {
?>
<?php echo $alt;?>
<br>
<?php
}
?>
</p>
<?php
}
$genre_terms = get_the_terms($the_post_id, 'genre');
$tag_terms = get_the_terms($the_post_id, 'post_tag');
if( !empty( $genre_terms )) {
?><h3>Genre</h3><?php
taxonomy_button_list( 'novel', $genre_terms , 'genre');
}
if( !empty( $tag_terms ) && $tag_terms[0]->name != 'None'){
?><h3>Tag</h3><?php
taxonomy_button_list( 'novel', $tag_terms, 'tags');
}
get_template_part('template-parts/edit-btn');
?>
</div>
</div>
</section>
<?php
get_template_part('template-parts/novel/volumeList');
get_template_part('template-parts/novel/universeNovels');
get_template_part('template-parts/novel/similarNovels');
get_template_part('template-parts/novel/relatedPosts');
?>
<section id="reviews-section"/>
<?php
endwhile;
}
?>
</div>
</div>
</main>
<?php get_footer();?>