-
Notifications
You must be signed in to change notification settings - Fork 3
/
singular.php
70 lines (65 loc) · 3.07 KB
/
singular.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
<?php get_header();
?>
<div class="post_container">
<div class="row wrapper">
<?php if (have_posts()) {
while (have_posts()) {
the_post();
$post_id = get_the_ID();
?>
<article>
<div class="post_header">
<h1 class="post_title"><?php the_title(); ?></h1>
<?php
$post_categories = wp_get_post_categories($post_id);
$category_counter = 1;
foreach ($post_categories as $category) {
if ($category_counter++ > 2) {
break;
}
$this_category = get_category($category);
$category_link = get_category_link($this_category);
echo " <a href='" . $category_link . "'><span class='badge'>" . $this_category->name . "</span> </a>";
}
?>
</div>
<div class="post_content"><?php the_content(); ?></div>
<div class="comments">
<div class="row comment_form">
<form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
<div class="row">
<label for="author">نام</label>
<input type="text" name="author" id="author">
</div>
<div class="row">
<label for="email">ایمیل</label>
<input type="email" name="email" id="email">
</div>
<div class="row">
<label for="comment_text">دیدگاه</label>
<textarea name="comment" id="comment_text"></textarea>
</div>
<div class="row">
<button name="submit" class="btn">ارسال نظر</button>
</div>
</form>
<img src="<?php echo get_template_directory_uri(); ?>/images/comment_illustration.svg" class="comment_illustration">
</div>
<?php
$comments_query = new WP_Comment_Query([
'status' => 'approve',
'parent' => 0,
'post_id' => $post_id
]);
set_query_var('comments_query', $comments_query);
get_template_part('comment');
?>
</div>
</article>
<?php }
}
get_template_part('sidebar');
?>
</div>
</div>
<?php get_footer(); ?>