This repository has been archived by the owner on Jan 7, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcontent-single.php
151 lines (130 loc) · 6.54 KB
/
content-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
<?php
/**
* Content Single
*/
?>
<!-- HEADER TITLE BREADCRUBS SECTION -->
<?php echo wp_kses_post(political_header_title_breadcrumbs()); ?>
<article id="main-content" <?php post_class('post high-padding'); ?>>
<div class="container">
<div class="row">
<!-- POST CONTENT -->
<div class="col-md-9 main-content">
<!-- HEADER -->
<div class="article-header">
<div class="article-details">
<?php
$thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ),'political_blog_900x550' );
if($thumbnail_src) { ?>
<?php the_post_thumbnail( 'political_blog_900x550' ); ?>
<?php } ?>
<div class="clearfix"></div>
<h1 class="post-title">
<strong><?php echo esc_html(get_the_title()); ?></strong>
</h1>
<div class="post-category-comment-date row">
<span class="post-date">
<i class="icon-calendar"></i>
<?php echo esc_html(get_the_date()); ?>
</span>
<span class="post-categories">
<?php echo wp_kses_post(get_the_term_list( get_the_ID(), 'category', '<i class="icon-tag"></i>', ', ' )); ?>
</span>
<span class="post-author">
<i class="icon-user icons"></i>
<a href="<?php echo esc_url(get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) )); ?>"><?php echo get_the_author(); ?></a>
</span>
<span class="post-comments">
<i class="icon-bubbles icons"></i>
<a href="<?php echo esc_url(get_the_permalink().'#comments'); ?>"><?php comments_number( '0', '1', '%' ); ?></a>
</span>
</div>
</div>
</div>
<!-- CONTENT -->
<div class="article-content">
<?php the_content(); ?>
<div class="clearfix"></div>
<?php
wp_link_pages( array(
'before' => '<div class="page-links">' . esc_html__( 'Pages:', 'political' ),
'after' => '</div>',
) );
?>
<div class="clearfix"></div>
<?php if (get_the_tags()) { ?>
<div class="single-post-tags">
<span><?php echo esc_html__('Tags:','political'); ?></span> <?php echo wp_kses_post(get_the_term_list( get_the_ID(), 'post_tag', '', ' ' )); ?>
</div>
<?php } ?>
<div class="clearfix"></div>
<!-- COMMENTS -->
<?php
// If comments are open or we have at least one comment, load up the comment template
if ( comments_open() || get_comments_number() ) {
comments_template();
}
?>
</div>
</div>
<div class="col-md-3 sidebar-content">
<?php get_sidebar(); ?>
</div>
</div>
</div>
</article>
<?php
$args=array(
'post__not_in' => array(get_the_ID()),
'posts_per_page' => 3, // Number of related posts to display.
'ignore_sticky_posts' => 1,
'post_status' => 'publish',
);
$post_query = new wp_query( $args );
$post_ids = get_posts(array(
'posts_per_page'=> -1,
'fields' => 'ids', // Only get post IDs
'post_status' => 'publish',
));
$count_ids = count($post_ids);
if($count_ids > 1) { ?>
<div class="clearfix"></div>
<div class="row post-details-bottom">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="related-posts sticky-posts high-padding-bottom">
<h2 class="heading-bottom"><?php esc_html_e('Related Posts', 'political'); ?></h2>
<div class="row">
<?php
while( $post_query->have_posts() ) {
$post_query->the_post();
?>
<div class="col-md-4 post">
<div class="related_blog_custom">
<?php $thumbnail_src = wp_get_attachment_image_src( get_post_thumbnail_id( get_the_ID() ),'political_related_post_pic500x300' ); ?>
<?php if($thumbnail_src){ ?>
<a href="<?php echo esc_url(get_the_permalink()); ?>" class="relative">
<?php if($thumbnail_src) { ?>
<img src="<?php echo esc_url($thumbnail_src[0]); ?>" class="img-responsive" alt="<?php the_title_attribute(); ?>" />
<?php } ?>
</a>
<?php } ?>
<div class="related_blog_details">
<h4 class="post-name"><a href="<?php echo esc_url(get_the_permalink()); ?>"><?php the_title(); ?></a></h4>
<div class="post-author"><?php echo esc_html__('Posted by ','political'); ?><a href="<?php echo esc_url(get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) )); ?>"><?php echo esc_html(get_the_author()); ?></a> - <?php echo esc_html(get_the_date()); ?></div>
</div>
</div>
</div>
<?php
} ?>
</div>
</div>
<?php
wp_reset_postdata();
?>
</div>
</div>
</div>
</div>
<?php } ?>