-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathsingle.php
207 lines (177 loc) · 6.59 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
<?php get_header();
if ($post->post_type=='downloadgroup'){
header('Location: /downloads');
exit();
}
?>
<div id="main" class="no-banner page-newsdetail">
<div class="container mx-auto">
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
<div class="row mb-5">
<div class="col-lg-7">
<?php if ( has_post_thumbnail()) : // Check if Thumbnail exists ?>
<!--<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">-->
<img src="<?php the_post_thumbnail_url('news_thumb'); // Fullsize image for the single post ?>" class="img-fluid mb-4" alt>
<!--</a>-->
<?php endif; ?>
<span class="date text-gray title-small"><?php the_time('F j, Y'); ?> <?php the_time('g:i a'); ?></span>
<h1 class="py-3">
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
<strong><?php the_title(); ?></strong>
</a>
</h1>
<div class="social-share">
<?php
$postURL = urlencode(get_the_permalink());
$postTitle = get_the_title();
$postIMG = urlencode(get_the_post_thumbnail_url());
$facebookURL = 'https://www.facebook.com/sharer.php?u=';
$twitterURL = 'https://twitter.com/share?url=';
$linkedinURL = "https://www.linkedin.com/sharing/share-offsite/?url=";
$pinterestURL = "https://pinterest.com/pin/create/bookmarklet/?media=";
$telegramURL = "https://telegram.me/share/url?url="
?>
<ul class="social-share-container">
<li>
<a target="_blank" href="<?php echo $facebookURL . $postURL; ?>" class="sharebtn facebook-btn">
<?php get_template_part('inc/fb.svg'); ?>
</a>
</li>
<li>
<a target="_blank" href="<?php echo $twitterURL . $postURL . '&text' . '=' . $postTitle; ?>" class="sharebtn twitter-btn">
<?php get_template_part('inc/twitter.svg'); ?>
</a>
</li>
<li>
<a target="_blank" href="<?php echo $linkedinURL . $postURL?>" class="sharebtn linkedin-btn">
<?php get_template_part('inc/linkedin.svg'); ?>
</a>
</li>
<li>
<a target="_blank" href="<?php echo $telegramURL . $postIMG . '&url=' . $postURL . '&description=' . $postTitle; ?>" class="sharebtn telegram-btn">
<?php get_template_part('inc/telegram.svg'); ?>
</a>
</li>
</ul>
</div>
<div class="richtext text-sm mb-5" id="test">
<?php the_content(); // Dynamic Content ?>
<p>
<?php if( get_field('original_author') ): ?>
Author: <?php echo the_field('original_author') ?><br>
<?php endif; ?>
<?php if( get_field('original_link') ): ?>
Original link: <a href="<?php echo the_field('original_link') ?>"><?php echo the_field('original_link') ?></a>
<?php endif; ?>
</p>
</div>
<?php
// the_tags( __( 'Tags: ', 'html5blank' ), ', ', '<br>');
?>
<?php
// _e( 'Categorised in: ', 'html5blank' ); the_category(', ');
?>
<?php edit_post_link(); // Always handy to have Edit Post Links available ?>
<?php
// comments_template();
?>
<hr>
<?php $author_id=$post->post_author; ?>
<div class="news-author mb-5">
<div class="row">
<div class="col-12"><h4><?php _e( 'About the author', 'html5blank' ); ?></h4></div>
</div>
<hr>
<div class="row">
<?php
$img = get_field('author_image', 'user_'.$author_id);
if ( $img!='' ){
echo '<div class="col-3"><img src="'.$img.'" class="img-fluid"></div>';
}
?>
<div class="col-9">
<h4><?php echo get_the_author_meta('display_name') ?></h4>
<p><?php the_field('positionspecialty', 'user_'.$author_id); ?></p>
<p><?php echo nl2br(get_the_author_meta('description')); ?></p>
</div>
</div>
</div>
<div class="row my-5">
<div class="col-12 news-back-btn">
<a href="/news/" class="text-gray title-small backlink"><?php _e( 'Back to all articles', 'html5blank' ); ?></a>
</div>
</div>
</div>
<div class="col-lg-4 offset-lg-1">
<div class="sidebar">
<div class="news-author mb-5">
<div class="row d-lg-flex d-none">
<?php
$img = get_field('author_image', 'user_'.$author_id);
if ( $img!='' ){
echo '<div class="col-3"><img src="'.$img.'" class="img-fluid"></div>';
}
?>
<div class="col-9">
<h4><?php echo get_the_author_meta('display_name') ?></h4>
<p><?php the_field('positionspecialty', 'user_'.$author_id); ?></p>
</div>
</div>
<hr>
<div class="clearfix">
<?php
$fb = get_field('facebook_link', 'user_'.$author_id);
$tw = get_field('twitter_link', 'user_'.$author_id);
$ld = get_field('linked_in', 'user_'.$author_id);
$dl = get_field('discord_link', 'user_'.$author_id);
$wa = get_field('whatsapp', 'user_'.$author_id);
$other = get_field('other_link', 'user_'.$author_id);
?>
<?php if ($fb!=''){?>
<a href="<?php echo $fb?>" class="fb" target="_blank"><?php get_template_part('inc/fb.svg'); ?></a>
<?php }?>
<?php if ($tw!=''){?>
<a href="<?php echo $tw?>" class="twitter" target="_blank"><?php get_template_part('inc/twitter.svg'); ?></a>
<?php }?>
<?php if ($ld!=''){?>
<a href="<?php echo $ld?>" class="twitter" target="_blank"><?php get_template_part('inc/linkedin.svg'); ?></a>
<?php }?>
<?php if ($dl!=''){?>
<a href="<?php echo $ld?>" class="twitter" target="_blank"><?php get_template_part('inc/discord.svg'); ?></a>
<?php }?>
<?php if ($wa!=''){?>
<a href="<?php echo $wa?>" class="whatsapp" target="_blank"><?php get_template_part('inc/whatsapp.svg'); ?></a>
<?php }?>
<?php if ($other!=''){?>
<a href="<?php echo $other?>" class="offsite" target="_blank"><?php get_template_part('inc/offsite.svg'); ?></a>
<?php }?>
</div>
<hr>
</div>
<div class="news-related">
<?php
$args = array( 'numberposts' => '5', 'post_status' =>'publish' );
$recent_posts = wp_get_recent_posts( $args );
foreach( $recent_posts as $recent ){ ?>
<div class="item">
<span class="title-small date"><?php echo get_the_date('F j, Y', $recent["ID"]); ?></span>
<a href="<?php echo get_permalink($recent["ID"])?>"><h4><?php echo $recent["post_title"]?></h4></a>
</div>
<?php }
wp_reset_query();
?>
</div>
</div>
</div>
</div>
<?php endwhile; ?>
<?php else: ?>
<!-- article -->
<article>
<h1><?php _e( 'Sorry, nothing to display.', 'html5blank' ); ?></h1>
</article>
<!-- /article -->
<?php endif; ?>
</div>
</div>
<?php get_footer(); ?>