forked from COPIM/copim_pub_wordpress_theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpage.php
More file actions
executable file
·185 lines (123 loc) · 5.64 KB
/
page.php
File metadata and controls
executable file
·185 lines (123 loc) · 5.64 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
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<?php
get_header();
?>
<main id="main-content" class="site-main" role="main">
<?php $has_image = get_field('header_image_toggle'); // Check if header has image?>
<section class="container-wrapper bg-color-warm-gray-800 header-bg" >
<div class="container article-header <?php echo $has_image ? '' : 'no-hero-image'; ?>">
<div class="row justify-left" >
<div class="section-header col <?php echo $has_image ? 'col-6' : 'col-10'; ?>">
<div class="section-header-title">
<?php // TITLE
the_title('<h1 class="entry-title">', '</h1>');
?>
<?php // Subtitle
if (get_field('header_subtitle')) { ?>
<?php echo '<div class="header-subtitle">' . wp_kses_post(get_field('header_subtitle')) . '</div>'; ?>
<?php } ?>
</div><!-- / section-header-title -->
</div><!-- / section-header -->
<?php // HEADER IMAGE
if (get_field('header_image_toggle')) {
if (get_field('header_image_toggle')) { //do you require an image??>
<?php if (get_field('header_image')) {
$image = get_field('header_image'); // Is an image selected?>
<div class="header-hero-image col col-6">
<figure class="extend-to-edge-right ">
<?php if ($image) {
// Get the alt text, fallback to title if no alt
$alt_text = get_post_meta($image['ID'], '_wp_attachment_image_alt', true);
if (empty($alt_text)) {
$alt_text = get_the_title();
}
echo wp_get_attachment_image(
$image['ID'],
'hero',
false,
[
'alt' => $alt_text,
'srcset' => wp_get_attachment_image_srcset($image['ID'], 'hero'),
'sizes' => '100vw', // 100% viewport width
'class' => 'hero-image',
'loading' => 'eager', // Load priority for above-fold content
]
);
} ?>
<?php if (get_field('header_image_caption')) { /// IMAGE CAPTION
$header_image_caption = get_field('header_image_caption');
echo '<figcaption class="wp-caption-text">' . wp_kses_post($header_image_caption) . '</figcaption>';
} ?>
</figure>
</div><!-- / image -->
<?php }
}
} ?>
</div><!-- / row -->
</div><!-- / container -->
</section><!-- / container-wrapper -->
<!-- ARTICLE -->
<div class="container-wrapper container-padding-top container-padding-bottom bg-color-warm-gray-100" >
<div class="container ">
<div class="row justify-center">
<div class="rte-content col col-8<?php if (get_field('rte_dropcap_toggle')) { ?> rte-dropcap <?php } else {
} ?> " >
<?php // ACF FLEX CONTENT
if (have_rows('rte_flexible_content')) {
while (have_rows('rte_flexible_content')) : the_row();
if (get_row_layout() == 'rte_content') { // CONTENT BLOCK
$content = get_sub_field('rte_content_block');
if ($content) {
echo '<div class="rte-content rte-content-block">';
echo do_shortcode(wpautop($content)); // allows footnotes to register/detected/counted without injecting output
echo '</div>';
}
} elseif (get_row_layout() == 'rte_table') { // TABLE
if (get_sub_field('rte_table_width') == 'wide') {
$rte_table_width = 'rte-full-width';
} else {
$rte_table_width = '';
}
echo '<div class="rte-content table-wrapper ' . $rte_table_width . '">' . do_shortcode(get_sub_field('rte_table_shortcode')) . '</div>';
} elseif (get_row_layout() == 'rte_code') { // CODE BLOCK
$rte_code = get_sub_field('rte_code_block');
echo '<div class="rte-content "><pre class="rte-code"><code>' . $rte_code . '</code></pre></div>';
} elseif (get_row_layout() == 'rte_large_image') { // LARGE IMAGE
if (get_sub_field('rte_large_image_block')) {
$image = get_sub_field('rte_large_image_block'); // Is an image selected?>
<figure class="rte-content rte-full-width">
<?php if ($image) {
// Get the alt text, fallback to title if no alt
$alt_text = get_post_meta($image['ID'], '_wp_attachment_image_alt', true);
if (empty($alt_text)) {
$alt_text = get_the_title();
}
echo wp_get_attachment_image(
$image['ID'],
'hero',
false,
[
'alt' => $alt_text,
'srcset' => wp_get_attachment_image_srcset($image['ID'], 'hero'),
'sizes' => '100vw', // 100% viewport width
'class' => 'large-image',
'loading' => 'lazy',
]
);
} ?>
<?php if (get_sub_field('rte_large_image_caption')) { // caption
$rte_large_image_caption = get_sub_field('rte_large_image_caption');
echo '<figcaption class="wp-caption-text">' . $rte_large_image_caption . '</figcaption>';
} ?>
</figure>
<?php }?>
<?php } // Close ACF Conditions
endwhile;
} else {
} ?>
</div><!-- / col -->
</div><!-- / row -->
</div><!-- / container -->
</div><!-- / container wrapper -->
</main><!-- / main -->
<?php
get_footer();