-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
130 lines (96 loc) · 4.02 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
<?php
/**
* The template for displaying all single posts.
*
* @package bb
*/
$cpost = get_queried_object();
get_header();
?>
<div class="main-content single-post-section">
<div class="container">
<header class="flex-row entry-header-single centered">
<div class="flex-cell flex-md-8">
<div class="entry-meta"><?php echo knd_posted_on($cpost); //for event ?></div>
<h1 class="entry-title"><?php echo get_the_title($cpost);?></h1>
<div class="mobile-sharing hide-on-medium"><?php echo knd_social_share_no_js();?></div>
</div>
</header>
<div class="flex-row entry-preview-single centered">
<div class="flex-cell flex-md-10">
<?php knd_single_post_thumbnail($cpost->ID, 'full', 'introimg'); ?>
</div>
</div>
<div class="flex-row entry-content-single">
<div class="flex-cell flex-md-1 hide-upto-medium"></div>
<div class="flex-cell flex-md-1 single-sharing-col hide-upto-medium">
<div id="knd_sharing" class="regular-sharing">
<?php echo knd_social_share_no_js();?>
</div>
</div>
<main class="flex-cell flex-md-8">
<div class="entry-lead">
<?php echo apply_filters('knd_the_content', $cpost->post_excerpt); ?>
</div>
<div class="entry-content the-content">
<?php echo apply_filters('the_content', $cpost->post_content); ?>
</div>
<?php
echo get_the_term_list(
$cpost->ID,
'post_tag',
'<div class="single-post-terms tags-line">',
', ',
'</div>'
);
?>
<?php
if($cpost->post_type == 'post') {
$cat = get_the_terms($post->ID, 'category');
$pquery = new WP_Query(array(
'post_type'=> 'post',
'posts_per_page' => 5,
'post__not_in' => array($cpost->ID),
'tax_query' => array(
array(
'taxonomy' => 'category',
'field' => 'id',
'terms' => (isset($cat[0])) ? $cat[0]->term_id : array()
)
)
));
if(!$pquery->have_posts()) {
$pquery = new WP_Query(array(
'post_type'=> 'post',
'posts_per_page' => 5,
'post__not_in' => array($cpost->ID),
));
}
knd_more_section($pquery->posts, __('Related items', 'knd'), 'news', 'addon');
}
elseif($cpost->post_type == 'project') {
$pquery = new WP_Query(array(
'post_type'=> 'project',
'posts_per_page' => 5,
'post__not_in' => array($cpost->ID),
'orderby' => 'rand'
));
if($pquery->have_posts()){
knd_more_section($pquery->posts, __('Related projects', 'knd'), 'projects', 'addon');
}
}
?>
</main>
<div class="flex-cell flex-md-2 hide-upto-medium"></div>
</div>
</div><!-- .container -->
</div><!-- .main-content -->
<div class="knd-signle-after-content">
<?php if($cpost->post_type == 'post'):?>
<?php dynamic_sidebar( 'knd-news-archive-sidebar' );?>
<?php else: ?>
<?php dynamic_sidebar( 'knd-projects-archive-sidebar' );?>
<?php endif ?>
</div>
<?php
get_footer();