forked from vanbexlabs/hackathon-wordpress-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
template-press.php
186 lines (178 loc) · 5.06 KB
/
template-press.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
<?php
/*
Template Name: Press
*/
get_header();
?>
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post();
$limit = 10;
$press_releases = get_field('press_releases');
$press = get_field('press');
// logos are image objects and files are urls
$logo = get_field('logo_preview');
$logo_file = get_field('logo_download');
$logo_dark = get_field('logo_preview_dark');
$logo_dark_file = get_field('logo_download_dark');
$logo_small = get_field('logo_preview_small');
$logo_small_file = get_field('logo_download_small');
$logo_small_dark = get_field('logo_preview_small_dark');
$logo_small_dark_file = get_field('logo_download_small_dark');
$press_assets = get_field('press_assets');
?>
<section class="press-intro">
<div class="container cf">
<?php the_content(); ?>
</div>
</section>
<?php if (!empty($press_releases)) { ?>
<section>
<div class="container cf">
<h3>Press Releases</h3>
<ul class="timeline">
<?php
$i = 1;
foreach ($press_releases as $item) {
$quote = $item['quote'];
$url = $item['url'];
$urlHTTP = substr($url, 0, 4);
$link_text = $item['link_text'];
$date = DateTime::createFromFormat('Ymd', $item['date']);
$classes = '';
if ($i > $limit) {
$classes = ' class="hide"';
}
echo '<li'. $classes .'><div class="bubble">';
echo $quote;
echo '<p class="meta">';
if (!empty($url)) {
if($urlHTTP !== 'http') {
echo '<a href="http://' . $url . '">';
} else {
echo '<a href="' . $url . '">';
}
}
echo $link_text;
if (!empty($url)) {
echo '</a>';
}
if (!empty($date)) {
echo ' - ' . $date->format('j F Y');
}
echo '</p>';
echo '</div></li>';
$i++;
}
if ($i > $limit) {
echo '<li class="more-bar"><a href="#" class="btn timeline-load">Show More</a></li>';
}
?>
</ul>
</div>
</section>
<?php } ?>
<?php if (!empty($press)) { ?>
<section class="alternate">
<div class="container cf">
<h3>In the Press</h3>
<ul class="timeline">
<?php
$i = 1;
foreach($press as $item) {
$quote = $item['quote'];
$url = $item['url'];
$urlHTTP = substr($url, 0, 4);
$link_text = $item['link_text'];
$date = DateTime::createFromFormat('Ymd', $item['date']);
$classes = '';
if ($i > $limit) {
$classes = ' class="hide"';
}
echo '<li'. $classes .'><div class="bubble">';
echo $quote;
echo '<p class="meta">';
if (!empty($url)) {
if($urlHTTP !== 'http') {
echo '<a href="http://' . $url . '">';
} else {
echo '<a href="' . $url . '">';
}
}
echo $link_text;
if (!empty($url)) {
echo '</a>';
}
if (!empty($date)) {
echo ' - ' . $date->format('j F Y');
}
echo '</p>';
echo '</div></li>';
$i++;
}
if ($i > $limit) {
echo '<li class="more-bar"><a href="#" class="btn timeline-load">Show More</a></li>';
}
?>
</ul>
</div>
</section>
<?php } ?>
<section>
<div class="container">
<h3>Press Assets</h3>
<div class="asset-logos cf">
<?php
if (!empty($logo)) {
$src = $logo['sizes']['medium'];
if (!empty($logo_file)) {
$url = $logo_file;
} else {
$url = $logo['sizes']['large'];
}
echo '<a class="press-logo" href="' . $url . '"><img src="' . $src . '" alt="logo" /></a>';
}
if (!empty($logo_dark)) {
$src = $logo_dark['sizes']['medium'];
if (!empty($logo_dark_file)) {
$url = $logo_dark_file;
} else {
$url = $logo_dark['sizes']['large'];
}
echo '<a class="press-logo logo-dark" href="' . $url . '"><img src="' . $src . '" alt="logo on dark" /></a>';
}
if (!empty($logo_small)) {
$src = $logo_small['sizes']['medium'];
if (!empty($logo_small_file)) {
$url = $logo_small_file;
} else {
$url = $logo_small['sizes']['large'];
}
echo '<a class="press-logo logo-small" href="' . $url . '"><img src="' . $src . '" alt="small logo" /></a>';
}
if (!empty($logo_small_dark)) {
$src = $logo_small_dark['sizes']['medium'];
if (!empty($logo_small_dark_file)) {
$url = $logo_small_dark_file;
} else {
$url = $logo_small_dark['sizes']['large'];
}
echo '<a class="press-logo logo-small logo-dark" href="' . $url . '"><img src="' . $src . '" alt="small logo on dark" /></a>';
}
?>
</div>
<div class="press-assets">
<?php
foreach($press_assets as $item) {
$src = $item['image']['sizes']['post-thumbnail'];
$url = $item['image']['sizes']['large'];
echo '<a href="' . $url . '"><img src="' . $src . '" alt="" /></a>';
}
?>
</div>
</div>
</section>
<?php
endwhile;
endif;
?>
<?php get_footer(); ?>