-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingle.php
161 lines (137 loc) · 4.22 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
<?php
/**
* The template for displaying all posts
*
* This is the template that displays all pages by default.
* Please note that this is the WordPress construct of pages
* and that other 'pages' on your WordPress site may use a
* different template.
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package WordPress
* @subpackage Twenty_Seventeen
* @since 1.0
* @version 1.0
*/
get_header();
while ( have_posts() ) : the_post();
$authorId = get_field('author');
if($authorId) {
$current_user_posts = get_posts(array(
'numberposts' => 3,
'post_type' => 'post',
'exclude' => get_the_ID(),
'meta_key' => 'author',
'meta_value' => $authorId,
/*
'meta_query' => array(
//'relation' => 'AND',
array(
'key' => 'author',
'value' => $authorId,
'compare' => '=',
),
),
*/
));
}
?>
<section id="maincontent" class="one-column-section blog-post">
<div class="container-fluid section-wrap section-padding bg-lightgrey">
<div class="col-xs-12 col-sm-3 col-md-offset-1 col-md-3">
<h2>
<span class="day"> <?php the_time('j<\s\up>S</\s\up> F <\b\r />Y'); ?></span>
</h2>
<?php if (has_post_thumbnail()) : ?>
<div class="image-container round featured" style="background-image: url('<?php the_post_thumbnail_url()?>')"></div>
<?php endif; ?>
<hr class="separator">
<div class="author">
<?php
if ($authorId && has_post_thumbnail($authorId)) {
echo '<div class="round">';
echo get_the_post_thumbnail($authorId, 'yumi-profile-size');
echo '</div>';
}
?>
Author:<br/>
<strong>
<?php echo get_field('first_name', $authorId) . ' ' . get_field('last_name', $authorId); ?>
</strong>
<?php
if( !empty($current_user_posts)): ?>
<ul>
<?php foreach($current_user_posts as $post): ?>
<li>
<a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach; wp_reset_postdata(); ?>
</ul>
<a class="dot-link" href="/blog/?by=<?php echo $authorId; ?>">View all <?php the_field('first_name', $authorId) ?>'s articles</a>
<?php endif; ?>
</div>
</div>
<div class="col-xs-12 col-sm-7 entry-content">
<?php the_content(); ?>
<div class="author author-mob">
<hr class="separator">
<?php
if ($authorId && has_post_thumbnail($authorId)) {
echo '<div class="round">';
echo get_the_post_thumbnail($authorId, 'yumi-profile-size');
echo '</div>';
}
?>
Author:<br/>
<strong>
<?php echo get_field('first_name', $authorId) . ' ' . get_field('last_name', $authorId); ?>
</strong>
<?php
if( !empty($current_user_posts)): ?>
<ul>
<?php foreach($current_user_posts as $post): ?>
<li>
<a href="<?php echo get_permalink(); ?>"><?php the_title(); ?></a>
</li>
<?php endforeach; wp_reset_postdata(); ?>
</ul>
<a class="dot-link" href="/blog/?by=<?php echo $authorId; ?>">View all <?php the_field('first_name', $authorId) ?>'s articles</a>
<?php endif; ?>
</div>
</div>
</div>
<div class="container-fluid section-padding">
<?php if ($related_posts = get_field('related_posts')) : ?>
<div class="col-xs-12 col-sm-offset-1 col-sm-3">
<h2>Related Articles</h2>
</div>
<div class="col-xs-12 col-sm-7 simple-object-list related-articles">
<?php
foreach ($related_posts as $post) : global $post; ?>
<div class="item table">
<div class="item-title cell">
<?php echo twentyseventeen_get_svg(array('icon'=>'chevron')); ?>
<strong>
<a href="<?php echo get_permalink(); ?>"><?php the_title(); ?>
</strong>
</div>
</div>
<?php endforeach; ?>
</div>
<?php endif; ?>
<div class="col-xs-12 col-sm-offset-4 col-sm-7">
<?php echo do_shortcode('[cta href="/blog/"]Back to blog[/cta]'); ?>
</div>
</div>
</section>
<script>
(function( $ ) {
$(function() {
// highlight services item in main navigation
$('#top-navigation #menu-item-224').addClass('current-menu-ancestor hover');
});
})( jQuery );
</script>
<?php endwhile; // End of the loop. ?>
<?php get_footer(); ?>