-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
158 lines (140 loc) · 4.26 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
<?php
/**
* The template for displaying all single posts.
*
* @package understrap
*/
get_header();
$container = get_theme_mod( 'understrap_container_type' );?>
<!--section Blog/Single post-->
<?php if( get_field('blog_post_name',get_option('page_for_posts')) ): ?>
<section class="blog_background_image"
style="background-image: url(<?php echo get_theme_mod('blog-back-image'); ?>);
background-size: cover; background-repeat: no-repeat; background-position: left center;">
<div class="container">
<h2 class="blog-name">
<?php the_field('blog_post_name',get_option('page_for_posts')); ?>
</h2>
</div>
</section>
<?php endif; ?>
<!--Main Post-->
<section class="<?php echo esc_attr( $container ); ?> padding-section">
<div class="row">
<div class="col-md-7 col-lg-8">
<main class="main-content">
<?php if( get_field('blog_title_post',get_option('page_for_posts')) ): ?>
<h2 class="section-title">
<?php the_field('blog_title_post',get_option('page_for_posts')); ?>
<span class="section-subtitle">
<?php the_field('blog_title_post_2',get_option('page_for_posts')); ?>
</span>
</h2>
<?php endif; ?>
<?php if (have_posts ()) : while ( have_posts() ) : the_post();?>
<div class="image-post-title">
<?php the_post_thumbnail();
$archive_year = get_the_time('Y');
$archive_month = get_the_time('m');
$archive_day = get_the_time('d');
?>
<div class="date-header">
<a href="<?= get_day_link($archive_year, $archive_month, $archive_day); ?>" class="blog-date">
<time datetime="<?= get_the_date('Y-m-d'); ?>" >
<?= get_the_date('M-j-Y'); ?>
</time>
</a>
<h2 class="img-title post-title">
<?php the_title() ?>
</h2>
</div>
</div>
<div class="single-content">
<?php the_content();?>
</div>
<?php endwhile; ?>
<?php endif; ?>
</main>
<div class="related-post-list">
<?php if( get_field('related_posts_title',get_option('page_for_posts')) ): ?>
<h2 class="related-post-title pb-5">
<?php the_field('related_posts_title',get_option('page_for_posts')); ?>
</h2>
<?php endif; ?>
<ul class="row flex-wrap">
<?php
$args = array(
'numberposts' => 3,
'offset' => 0,
'category' => 0,
'orderby' => 'post_date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'post',
'post_status' => 'publish',
'post__not_in' => array(get_the_ID()),
'suppress_filters' => true,
'tax_query' => array(
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => 'post-format-audio',
'operator' => 'NOT IN'
),
array(
'taxonomy' => 'post_format',
'field' => 'slug',
'terms' => 'post-format-quote',
'operator' => 'NOT IN'
)
));
$recent_posts = wp_get_recent_posts($args);
?>
<?php foreach ($recent_posts as $recent_post) { ?>
<li class="col-12 col-lg-4 recent">
<a href="<?php the_permalink($recent_post['ID']); ?>">
<?php echo get_the_post_thumbnail($recent_post['ID']); ?>
</a>
<h4 class="recent-post-title pt-3">
<a href="<?= get_permalink($recent_post["ID"]) ?>">
<?= $recent_post['post_title']; ?>
</a>
</h4>
<?php
$archive_year = get_the_time('Y');
$archive_month = get_the_time('m');
$archive_day = get_the_time('d');
?>
<a href="<?= get_day_link($archive_year, $archive_month, $archive_day); ?>" class="d-inline-block" >
<time datetime="<?php echo date('Y-m-d', strtotime($recent_post['post_date']));?>" >
<?php echo date('d-M-Y', strtotime($recent_post['post_date']));?>
</time>
</a>
<?php } ?>
</li>
</ul>
</div>
<div class="pt-5 mt-5">
<?php
if ( comments_open() || get_comments_number() ) :
comments_template();
endif;
?>
</div>
</div>
<aside class="sidebar col-md-5 col-lg-4">
<?php dynamic_sidebar('right-page-sidebar'); ?>
</aside>
</div>
</section>
<section class="back">
<div class="<?php echo esc_attr( $container ); ?>">
<div class="padding-section col-12 col-md-7 col-lg-8">
<?php comment_form(); ?>
</div>
</div>
</section>
<?php get_footer(); ?>