-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsingle-article.php
More file actions
executable file
·167 lines (159 loc) · 3.77 KB
/
single-article.php
File metadata and controls
executable file
·167 lines (159 loc) · 3.77 KB
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
<?php
get_header();
$post_id = get_the_ID();
$title = get_the_title();
$pub_date = get_the_date( 'd-m-Y', $post_id );
$article_content = ! empty( get_field( 'article-content', $post_id ) ) ? apply_filters( 'the_content', get_field( 'article-content', $post_id ) ) : '';
$article_downloads = get_field( 'article-downloads', $post_id );
$article_links = get_field( 'article-links', $post_id );
$header_image = get_field( 'article-image', $post_id );
$modified_date = get_the_modified_date( 'd-m-Y H:i:s' );
if ( post_password_required() ) {
?>
<div class="grid-container">
<div class="grid-x grid-margin-x">
<div class="cell medium-8">
<?php echo get_the_password_form( $post->ID ); ?>
</div>
</div>
</div>
<?php
} else {
while ( have_posts() ) {
the_post();
get_template_part(
'blocks/_global/single-header-image',
'',
array(
'header_image' => $header_image,
),
);
?>
<section class="single-article-content">
<div class="grid-x grid-margin-x">
<div class="cell large-8">
<div class="article-intro">
<?php
echo strl_add_read_speaker();
if ( ! empty( $title ) ) {
?>
<h1><?php echo $title; ?></h1>
<?php
}
if ( ! empty( $pub_date ) ) {
?>
<span class="created pub-date">
<?php
echo sprintf(
// translators: %s is publish date
__( 'Created on: %s', 'strl-frontend' ),
$pub_date
);
?>
</span>
<br>
<?php
}
if ( ! empty( $modified_date ) ) {
?>
<span class="modified pub-date">
<?php
echo sprintf(
// translators: %s is last modifed date
__( 'Last modified on: %s', 'strl-frontend' ),
$modified_date
);
?>
</span>
<?php
}
?>
</div>
</div>
<div class="cell large-3 large-offset-1 large-order-2 small-order-1 sidebar">
<?php
if ( $article_links ) {
?>
<div class="widget">
<div class="bg-quaternary">
<p class="widget-title"><?php _e( 'Links', 'strl-frontend' ); ?></p>
</div>
<div class="widget-content">
<ul>
<?php
foreach ( $article_links as $link ) {
?>
<li>
<?php
echo strl_link(
$link['link'],
array(),
array(),
'fa-regular fa-arrow-up-right-from-square',
);
?>
</li>
<?php
}
?>
</ul>
</div>
</div>
<?php
}
?>
</div>
</div>
<div class="grid-x grid-margin-x grid-margin-y">
<div class="cell large-8 large-order-1 small-order-2">
<div class="article-inner">
<?php
if ( ! empty( $article_content ) ) {
get_template_part(
'blocks/textonly/textonly',
'',
array(
'content' => $article_content,
),
);
}
?>
</div>
</div>
</div>
</section>
<?php
if ( ! empty( $article_downloads ) ) {
?>
<section class="downloads">
<div class="grid-x grid-margin-x">
<div class="cell large-8 small-12">
<h2><?php _e( 'Downloads', 'strl' ); ?></h2>
<ul class="downloads-list">
<?php
foreach ( $article_downloads as $download ) {
$download = $download['download'];
if ( ! empty( $download ) ) {
get_template_part(
'blocks/_global/download-link',
'',
array(
'link_url' => $download['url'],
'link_title' => $download['title'],
'link_type' => 'download',
),
);
}
}
?>
</ul>
</div>
</div>
</section>
<?php
}
?>
<?php
}
}
get_footer();