-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscratch.php
334 lines (274 loc) · 10.8 KB
/
scratch.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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
<?php
//////////////////////////////////////////////
// holder.js Stuff -- Load Script in Footer.php
//////////////////////////////////////////////
?>
<img data-src="holder.js/3000x2000?auto=yes&textmode=exact">
<script>
Holder.addTheme('gray', {
bg: '#777',
fg: 'rgba(255,255,255,.75)',
font: 'Helvetica',
fontweight: 'normal'
});
</script>
<?php the_post_thumbnail('post-thumbnail', ['class' => 'img-responsive responsive--full', 'title' => 'Feature image']); ?>
<?php
//////////////////////////////////////////////
// ACF SPECIFIC CODE SNIPPETS
//////////////////////////////////////////////
?>
<?php the_field('header_title', 'option'); ?>
<?php the_post_thumbnail('landscape-mobile', array( 'alt' => get_the_title() )); ?>
<?php echo wp_get_attachment_image(get_sub_field('image'), 'landscape-tablet', 0, array('class' => 'example-class', 'alt' => get_the_title() )); ?>
<?php /////////////// Conditional Content Check ?>
<?php if( get_field('field') ): ?>
<p><?php the_field('field'); ?></p>
<?php endif; ?>
<?php /////////////// Get Custom Taxonomies from Custom Post Type ?>
<?php
$spm_terms = wp_get_object_terms( $post->ID, 'focus' );
foreach( $spm_terms as $term ) {
echo '<p><a href="' . get_term_link( $term->slug, 'focus' ) . '">' . esc_html( $term->name ) . '</a></p>';
} ?>
<div class="searchButton">
<i id="searchButton" class="fa fa-search" aria-hidden="true"></i>
</div>
<?php ///////// Display Custom Taxonomy for Posts ?>
<?php $spm_taxes = array('sep' => ' ', 'template' => '% %l');the_taxonomies( $spm_taxes ); ?>
<?php ///////// Display Category for Post ?>
<?php the_category( ' ' ); ?>
<?php // Hero Image w/Static Text <p>
$headerhero = get_field('header_hero');
echo '<div class="featuredImage row" style="background-image:url(' . $donatehero . ');
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
">';
echo '<p class="hero-title">DONATE</p>';
echo '</div>';
?>
<?php // Hero Image w/Dynamic Text <h1>
$headerhero = get_field('header_hero');
$headertext = get_field('header_text');
echo '<div class="featuredImage row" style="background-image:url(' . $donatehero . ');
background-size: cover;
background-position: center center;
background-repeat: no-repeat;
">';
echo '<h1 class="hero-title">' . $donatehero . '</p>';
echo '</div>';
?>
<?php if( have_rows('frequently_asked_questions') ): while ( have_rows('frequently_asked_questions') ) : the_row(); ?>
<div class="fieldContainer">
<h1><?php the_sub_field('sub_field'); ?></h1>
<p><?php the_sub_field('sub_field'); ?></p>
</div>
<?php endwhile; else : endif; ?>
<?php // Repeater Field - 2 Tier
if( have_rows('example_field_one') ):
while( have_rows('example_field_one') ): the_row();
?>
<div class="firstFieldContainer">
<h2><?php the_sub_field('example_field_header'); ?></h2>
<p><?php the_sub_field('example_field_content'); ?></p>
<?php if( have_rows('example_field_two') ): ?>
<div class="secondFieldContainer">
<?php while( have_rows('example_field_two') ): the_row(); ?>
<h3><?php the_sub_field('example_field_second_header'); ?></h3>
<p><?php the_sub_field('example_field_second_content'); ?></p>
<?php endwhile; ?>
</div><!-- secondFieldContainer -->
<?php endif; ?>
</div><!-- firstFieldContainer -->
<?php endwhile; ?>
<?php endif; ?>
<!-- Post Select / Single Post Select -->
<?php $post_object = get_field('post_object');
if( $post_object ): $post = $post_object;setup_postdata( $post );?>
<?php wp_reset_postdata(); ?>
<?php endif; ?>
<?php // Post Object Field w/ Multiple Select
$post_objects = get_field('home_recipes'); if( $post_objects ): ?>
<?php foreach( $post_objects as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
<h2><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
<p><?php the_content(); ?></p>
<?php endforeach; ?>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
<?php // Post Object Field w/ Multiple Select (Post ID Selected)
$post_objects = get_sub_field('list_here'); if( $post_objects ): ?>
<ul>
<?php foreach( $post_objects as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
<li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php endif; ?>
<?php // Responsive Image Rendered
echo wp_get_attachment_image(get_sub_field('image'), 'full');
?>
<?php // Responsive Image Rendered w/Class Name
echo wp_get_attachment_image(get_sub_field('image'), 'full', 0, array('class' => 'example'));
?>
<?php // Flexslider Example Code
$images = get_field('gallery');
if( $images ): ?>
<div id="slider" class="flexslider">
<ul class="slides">
<?php foreach( $images as $image ): ?>
<li>
<img src="<?php echo $image['url']; ?>" alt="<?php echo $image['alt']; ?>" />
<p><?php echo $image['caption']; ?></p>
</li>
<?php endforeach; ?>
</ul>
</div>
<div id="carousel" class="flexslider">
<ul class="slides">
<?php foreach( $images as $image ): ?>
<li>
<img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" />
</li>
<?php endforeach; ?>
</ul>
</div>
<?php endif; ?>
<?php ////// Time without dash if empty end date //////// ?>
<li>
<?php the_sub_field('today_start'); ?>
<?php
$ending = get_sub_field('today_end');
if ($ending != 0) {
echo '- ' . $ending;
}
?>
</li>
<?php
//////////////////////////////////////////////
//////////////////////////////////////////////
// WORDPRESS SPECIFIC CODE SNIPPETS
//////////////////////////////////////////////
//////////////////////////////////////////////
?>
<?php // Get title of PARENT PAGE
$parent_title = get_the_title( $post->post_parent );
echo '<h3>' . $parent_title . '</h3>';
?>
<?php // Get excerpt and TRIM WORDS without BREAKING READMORE TEXT
$articlelink = get_the_permalink();
$articlecontent = wp_trim_words( get_the_excerpt(), 30, '...' );
echo '<p>' . $articlecontent . '<a class="readMore" style="display:inline-block;" href="' . $articlelink . '"> CONTINUE »</a></p>';
?>
<?php // Blog Post Feed
$blog_posts = new WP_Query( array('posts_per_page'=> 2, 'ignore_sticky_posts' => 1, 'cat' => '-16') );
while ($blog_posts->have_posts()) : $blog_posts->the_post(); ?>
<div class="blogItem col-sm-12 col-md-6 col-lg-12">
<div class="blogPost">
<?php the_post_thumbnail(); ?>
<div class="blogContent">
<p class="blogCategory"><?php the_category( ' ' ); ?></p>
<h3 class="blogTitle"><a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
<div class="blogExcerpt">
<?php
$blogLink = get_the_permalink();
$blogContent = wp_trim_words( get_the_excerpt(), 30, '...' );
echo '<p>' . $blogContent . '<a class="readMore" href="' . $blogLink . '"> READ MORE »</a></p>';
?>
</div>
<p class="blogTags"><?php the_tags(' ', ', '); ?></p>
</div>
</div>
</div><!-- blogItem -->
<?php wp_reset_postdata(); ?>
<?php endwhile; // End of news loop. ?>
<?php
//////////////////////////////////////////////
//////////////////////////////////////////////
// Automatic Sidebar Navigation
//////////////////////////////////////////////
//////////////////////////////////////////////
?>
<?php
if ( $post->post_parent ) {
$children = wp_list_pages( array(
'title_li' => '',
'child_of' => $post->post_parent,
'sort_column' => 'menu_order',
'echo' => 0
) );
} else {
$children = wp_list_pages( array(
'title_li' => '',
'child_of' => $post->ID,
'sort_column' => 'menu_order',
'echo' => 0
) );
}
if ( $children ) : ?>
<ul>
<?php echo $children; ?>
</ul>
<?php endif; ?>
<?php
//////////////////////////////////////////////
//////////////////////////////////////////////
// JQUERY SPECIFIC CODE SNIPPETS
//////////////////////////////////////////////
//////////////////////////////////////////////
?>
<script>
FastClick.attach(document.body);
jQuery (".accordion h4 ~ div").hide();
jQuery (".accordion h4").click(function() {
jQuery(this).next().slideToggle("slow");
jQuery(this).toggleClass('active');
event.preventDefault();
});
jQuery(".mobileSearch").click(function() {
jQuery('#searchForm').slideToggle();
event.preventDefault();
});
jQuery(".desktopSearch").click(function() {
jQuery('#searchForm').slideToggle();
event.preventDefault();
});
jQuery('.whereActionAbroad').on('click', function() {
jQuery.smoothScroll({
scrollTarget: '#abroadOptions',
offset: -100
});
return false;
});
jQuery('.whereActionUSA').on('click', function() {
jQuery.smoothScroll({
scrollTarget: '#usaOptions',
offset: -100
});
return false;
});
jQuery('#backtotop a').on('click', function() {
jQuery.smoothScroll({
scrollTarget: '#page'
});
return false;
});
</script>
// Popup menu at footer
<div class="row">
<div id="footerPopup">
<?php wp_nav_menu( array( 'theme_location' => 'student-landing', 'menu_id' => 'Student Landing' ) ); ?>
</div>
</div>
<script>
var offset = 250;
jQuery(window).scroll(function() {
if (jQuery(this).scrollTop() > offset) {
jQuery('#footerPopup').fadeIn();
} else {
jQuery('#footerPopup').fadeOut();
}
});
</script>