-
Notifications
You must be signed in to change notification settings - Fork 0
/
single.php
228 lines (195 loc) · 9.42 KB
/
single.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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<?php
get_header() ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php setPostViews(get_the_ID()); ?>
<!-- end of header -->
<div class="col-12" style="padding: 0;">
<div class="article_breadCrumb">
<h1><?php echo get_the_title() ?></h1>
<ul>
<li><a href="<?php echo home_url(); ?>">فروشگاه فردا مارکت</a></li>
<?php $category = get_categories();
$category_name = "";
?>
<?php foreach ($category as $cat): ?>
<li><a href="<?php echo home_url().'/category/'. $cat->slug ?>"><?php echo $cat->name ?></a></li>
<?php $category_name = $cat->name; ?>
<?php endforeach; ?>
</ul>
</div>
</div>
<div class="container-fluid main_container">
<div class="article_section_custom_1">
<div class="article_search_custom">
<span class="fa fa-search"></span>
</div>
<div id="main-aritcle" class="col-12 col-lg-7">
<div class="article">
<div class="article_title">
<h1><?php echo get_the_title(); ?></h1>
<div class="author">
<span>نویسنده :</span>
<span><?php echo get_the_author(); ?></span>
</div>
<div class="date">
<span>تاریخ :</span>
<span><?php echo get_the_date(); ?> </span><i class="fa fa-clock-o"></i>
</div>
</div>
<div class="article_author">
<div class="category">
<span>دسته بندی :</span>
<span> <?php $category = (get_categories()) ?>
<?php foreach ($category as $cat): ?>
<a href="<?php echo home_url().'/category/'. $cat->slug ?>"><?php echo $cat->name ?></a>
<?php endforeach; ?></span>
</div>
</div>
<div class="article_image_2">
<img src="<?php echo get_the_post_thumbnail_url() ?>" alt="">
</div>
<div class="article_content">
<?php the_content(); ?>
</div>
<div class="blockquoteSection">
<blockquote>
<?php the_excerpt(); ?>
</blockquote>
</div>
<div class="view">
<span class="fa fa-eye"></span> <?php echo get_post_meta(get_the_ID(), 'post_views_count', true); ?>
بازدید
</div>
<div class="stick">
<span> برچسب : </span>
<div>
<?php
$tags = get_tags(array(
'hide_empty' => false
));
foreach ($tags as $tag) {
echo '<span>' . $tag->name . '</span>';
}
?>
</div>
</div>
</div>
<div style="display: none" >
<p id="author-comment"><?php $current_user = wp_get_current_user();
echo $current_user->nickname; ?></p>
<p id="email-comment"><?php $current_user = wp_get_current_user();
echo $current_user->user_email; ?></p>
<p id="post-comment"><?php echo get_the_ID(); ?></p>
<p id="home-comment"><?php echo home_url() ?></p>
</div>
<div class="comment_section">
<!-- --><?php //wp_comment_reply(); ?>
<form action="<?php echo home_url() ?>/wp-comments-post.php" method="post">
<div class="col-12 col-md-6" style="padding: 0;">
<textarea name="comment" id="" cols="30" rows="10" placeholder="نظر شما"></textarea>
</div>
<div class="col-12 col-md-6" style="padding-left: 0;">
<label for="">نام و نام خانوادگی خود را بنویسید</label>
<input name="author" type="text" placeholder="نام"
value="<?php $current_user = wp_get_current_user();
echo $current_user->nickname; ?>">
<label for="">ایمیل خود را بنویسید</label>
<input name="email" type="email" placeholder="ایمیل"
value="<?php $current_user = wp_get_current_user();
echo $current_user->user_email; ?>">
<label for="" class="checkBoxCustom">
ذخیره نام و ایمیل
</label>
<input type="checkbox">
<button name="submit" type="submit">ارسال نظر</button>
</div>
<input type="hidden" name="comment_post_ID" value="<?php echo get_the_ID(); ?>"
id="comment_post_ID">
<input type="hidden" name="comment_parent" id="comment_parent" value="0">
</form>
</div>
<?php
$id_post = get_the_ID();
$comments = get_comments(
array(
'post_id' => $id_post
)
);
if (!empty($comments)) {
?>
<div class="comment_reply">
<?php
foreach ($comments as $comment) { ?>
<div class="col-12 col-sm-4">
<div class="comment_reply_image">
<?php
echo get_avatar($comment->user_id) ?>
<span class="date">
<?php echo $comment->comment_date; ?>
</span>
</div>
</div>
<div class="col-12 col-sm-8" style="padding: 0;">
<div class="comment_answer">
<p><?php echo $comment->comment_content ?>
</p>
<button id="btn_replay-<?php echo $comment->comment_ID?>" class="btn-replay"><a href="#/">پاسخ</a></button>
</div>
</div>
<?php } ?>
</div>
<?php
} else {
?>
<div class="col-12 col-sm-4">
<div class="comment_reply_image">
<img src="" alt="">
<span class="date">
</span>
</div>
</div>
<div class="col-12 col-sm-8" style="padding: 0;">
</div>
<?php } ?>
<div id="main-replay">
</div>
</div>
<div class="article_related_post">
<div class="article_related_post_title">
<h4>مطالب مرتبط </h4>
</div>
<?php
$post_related = new WP_Query(
[
'category_name' => $category_name,
'posts_per_page' => 3,
'orderby' => 'date',
'order' => 'DESC'
]
) ?>
<?php if ($post_related->have_posts()):while ($post_related->have_posts()): $post_related->the_post(); ?>
<div class="article_related_post_custom">
<img src="<?php echo get_the_post_thumbnail_url() ?>" alt="">
<div class="article_related_post_custom_info">
<a href="<?php echo get_the_permalink(); ?>">
<span><?php echo get_the_title(); ?></span>
</a>
<span><?php echo get_the_date(); ?><span class="fa fa-clock-o"></span></span>
</div>
</div>
<?php endwhile; endif; ?>
</div>
</div>
</div>
<!-- end of suplementary section -->
<div class="container-fluid container_custom">
<div class="go_top_section">
<div onclick="goTop()">
<i class="fa fa-chevron-circle-up"></i>
<span>بازگشت به بالا</span>
</div>
</div>
</div>
<!-- end of the scroll to top section -->
<?php endwhile; endif; ?>
<?php get_footer(); ?>