-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsingle-book.php
130 lines (108 loc) · 4.05 KB
/
single-book.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
<?php
get_header();
the_post();
$meta = get_post_meta(get_the_ID());
?>
<article class="wrapper">
<header>
<h1>
<?php if (!empty($meta['subtitle_head'][0])) { ?>
<span class="subtitle">
<?= $meta['subtitle_head'][0] ?>
</span>
<?php } ?>
<span class="title"><?php the_title(); ?></span>
<?php if (!empty($meta['subtitle_tail'][0])) { ?>
<span class="subtitle">
<?= $meta['subtitle_tail'][0] ?>
</span>
<?php } ?>
</h1>
</header>
<aside class="margin-bottom">
<?php
$book_author_string = get_term_names('book_author', ' 지음');
$book_translator_string = get_term_names('book_translator', ' 번역');
$book_publisher_string = get_term_names('book_publisher');
$book_subject_string = get_term_names('book_subject');
?>
<ul class="nav">
<?php if ($book_author_string) { ?>
<li class="nav-item"><?= $book_author_string ?></li>
<?php } ?>
<?php if ($book_translator_string) { ?>
<li class="nav-item"><?= $book_translator_string ?></li>
<?php } ?>
<?php if ($book_publisher_string) { ?>
<li class="nav-item"><?= $book_publisher_string ?></li>
<?php } ?>
<?php if ($book_subject_string) { ?>
<li class="nav-item"><?= $book_subject_string ?></li>
<?php } ?>
</ul>
<div>
<?php if (!empty($meta['published_date'][0])) { ?>
<?= $meta['published_date'][0] ?> 발행 |
<?php } ?>
<?php if (!empty($meta['pages'][0])) { ?>
<?= $meta['pages'][0] ?> |
<?php } ?>
<?php if (!empty($meta['price'][0])) { ?>
<?= number_format($meta['price'][0]) ?> |
<?php } ?>
<?php if (!empty($meta['isbn'][0])) { ?>
<?= $meta['isbn'][0] ?>
<?php } ?>
</div>
</aside>
<div class="book-cover-container">
<?php
$cover_id = get_post_meta(get_the_ID(), 'cover_id', true);
echo wp_get_attachment_image($cover_id, 'book_cover');
?>
</div>
<div>
<h3>책 소개</h3>
<?php
if (empty(get_the_content())) {
?>
<p>책 소개가 아직 입력돼 있지 않습니다.</p>
<?php
} else {
the_content();
}
?>
</div>
<?php if (!empty($meta['toc'][0])) { ?>
<div>
<h3>목차</h3>
<?php
$toc = apply_filters('the_content', $meta['toc'][0]);
$toc = str_replace(']]>', ']]>', $toc);
echo $toc;
?>
</div>
<?php } ?>
<?php if (!empty($meta['book_author_intro'][0])) { ?>
<div>
<h3>저자 소개</h3>
<?php
$book_author_intro = apply_filters('the_content', $meta['book_author_intro'][0]);
$book_author_intro = str_replace(']]>', ']]>', $book_author_intro);
echo $book_author_intro;
?>
</div>
<?php } ?>
<?php if (!empty($meta['book_translator_intro'][0])) { ?>
<div>
<h3>역자 소개</h3>
<?php
$book_translator_intro = apply_filters('the_content', $meta['book_translator_intro'][0]);
$book_translator_intro = str_replace(']]>', ']]>', $book_translator_intro);
echo $book_translator_intro;
?>
</div>
<?php } ?>
</article>
<?php
get_footer();