-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage.php
280 lines (206 loc) · 8.84 KB
/
page.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
<?php get_header(); ?>
<main id="content" role="main">
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php if( is_page('Home') ): ?>
<section class="banner">
<?php if( get_field('banner_type') == 'video' ): ?>
<video muted autoplay <?php if( get_field('loop') ): ?>loop<?php endif; ?> playsinline>
<source src="<?php the_field('video_url'); ?>" type="video/mp4">
</video>
<?php elseif( get_field('banner_type') == 'image' ): ?>
<?php $image = get_field('banner_image'); $size = 'large'; ?>
<div class="image-box ">
<?php echo wp_get_attachment_image( $image, $size, false, array( "loading" => "eager" ) ); ?>
</div>
<?php elseif( get_field('banner_type') == 'slideshow' ): ?>
<!-- Find Slideshow documentation at https://swiffyslider.com/docs -->
<?php if( have_rows('slides') ): $count = 1; ?>
<section class="swiffy-slider slider-nav-autoplay slider-item-nogap" data-slider-nav-autoplay-interval="4500">
<ul class="slider-container">
<?php while( have_rows('slides') ): the_row(); $image = get_sub_field('image'); ?>
<li aria-label="<?php echo $image['alt'] ?>" >
<img width="<?php echo $image['width']; ?>" height="<?php echo $image['height']; ?>" src="<?php echo $image['sizes']['large']; ?>" alt="<?php echo $image['alt'] ?>"
<?php if( $count > 1 ) { echo ' loading=lazy decoding="async" '; } ?> >
</li>
<?php $count++; ?>
<?php endwhile; ?>
</ul>
<button type="button" class="slider-nav"></button>
<button type="button" class="slider-nav slider-nav-next"></button>
</section>
<?php endif; ?>
<?php else: ?> <!-- Fallback so old templates don't get broken in update -->
<?php if( get_field('video_background') ): ?>
<video muted autoplay <?php if( get_field('loop') ): ?>loop<?php endif; ?> playsinline>
<source src="<?php the_field('video_url'); ?>" type="video/mp4">
</video>
<?php else: ?>
<?php $image = get_field('banner_image'); $size = 'large'; ?>
<div style="background-image:url(<?php echo wp_get_attachment_image_url( $image, $size ); ?>);" class="image-box "></div>
<?php endif; ?>
<?php endif; ?>
<?php if( get_field('franchise_area_name') ): ?>
<div class="textbox">
<h1><span class="cleaning-title"><?php the_field('banner_title'); ?></span>
<big class="franchise-area-title">
<?php the_field('franchise_area_name'); ?>
</big>
</h1>
<a class="primary button" href="<?php the_field('button_link'); ?>"><?php the_field('button_text'); ?></a>
</div>
<?php endif; ?>
<img alt=" " class="clouds" src="https://res.cloudinary.com/ez-nettools/image/upload/v1670868099/clouds_vector3_kt5cak.svg" />
</section>
<?php endif; ?>
<?php the_field('unique_selling_point' ) ;?>
<?php if( have_rows('featured_services') ): ?>
<section id="featured-services" class="featured-services">
<header class="section-header">
<?php the_field('featured_services_title'); ?>
</header>
<div class="inner">
<?php while( have_rows('featured_services') ): the_row();
$image = get_sub_field('featured_image'); $content = get_sub_field('featured_name'); $link = get_sub_field('featured_link');
?>
<figure>
<?php if( $link ): ?><a href="<?php echo $link; ?>"><?php endif; ?>
<img loading=lazy decoding="async" src="<?php echo $image['sizes']['medium']; ?>" alt="<?php echo $image['alt'] ?>" />
<figcaption><?php echo $content; ?></figcaption>
<?php if( $link ): ?></a><?php endif; ?>
</figure>
<?php endwhile; ?>
</div>
<footer class="section-footer"><?php the_field('all_services_button'); ?></footer>
</section>
<?php endif; ?>
<?php if( get_field('homepage_summary') ): ?>
<section id="homepage-summary" class="homepage-summary">
<div class="maxwidth">
<?php the_field('homepage_summary'); ?>
<footer class="maxwidth">
<?php the_field('homepage_summary_button'); ?>
</footer>
</div>
</section>
<?php endif; ?>
<?php if( '' !== get_post()->post_content ): ?>
<section class="entry-content">
<div class="maxwidth">
<?php the_content(); ?>
</div>
</section>
<?php endif; ?>
<?php if( get_field('include_coupons_on_homepage') and get_field('special_deal_post') ): ?>
<section id="coupons" class="coupons">
<header class="section-header">
<?php the_field('coupon_title'); ?>
</header>
<!-- ========= Special Deal Coupons ========== -->
<?php $post_objects = get_field('special_deal_post');
if( $post_objects ): ?>
<div class="coupon-collection">
<?php foreach( $post_objects as $post): // variable must be called $post (IMPORTANT) ?>
<?php setup_postdata($post); ?>
<?php get_template_part( 'coupons' ); ?>
<?php endforeach; ?>
<?php wp_reset_postdata(); // IMPORTANT - reset the $post object so the rest of the page works correctly ?>
<?php if( get_field('full_size_all_specials') ): ?>
<a class=" see-all show" href="/deal/">
<div class="shine"></div>
<h4><?php the_field('all_specials_tile_text'); ?></h4>
</a>
<?php endif; ?>
</div>
<?php endif;?>
<?php if( get_field('small_all_specials_button') ): ?>
<footer class="section-footer"><?php the_field('special_deals_button'); ?></footer>
<?php endif; ?>
<?php if( get_field('3d_hover_effect') ): /*-- 3D effect javascript--*/ ?>
<script>
addEventListener('DOMContentLoaded', e => {
const couponWrapper = document.querySelector('#coupons');
const coupons = couponWrapper.querySelectorAll('.coupon');
coupons.forEach( coupon => {
couponWidth = Math.floor( coupon.getBoundingClientRect().width );
coupon.style.setProperty('--width', couponWidth );
couponHeight = Math.floor( coupon.getBoundingClientRect().height );
coupon.style.setProperty('--height', couponHeight );
coupon.addEventListener('mousemove', e => {
coupon.style.setProperty('--mouseX', e.clientX - coupon.getBoundingClientRect().left );
coupon.style.setProperty('--mouseY', e.clientY - coupon.getBoundingClientRect().top );
e.cancelBubble = true;
})
coupon.addEventListener('mouseenter', e => {
coupon.classList.add('is_hovered');
});
coupon.addEventListener('pointerleave', e => {
coupon.classList.remove('is_hovered');
})
})
})
</script>
<?php endif; ?>
</section>
<?php endif;?>
<?php if( have_rows('testimonial_repeater') ): ?>
<?php $ratingTotal = 0; $ratingCount = 0; ?>
<section class="review-wrapper">
<?php while( have_rows('testimonial_repeater') ): the_row(); $review = get_sub_field('review'); $cite = get_sub_field('cite'); $date = get_sub_field('date'); ?>
<div class="h-review">
<blockquote>
<?php $starCount = get_sub_field('rating'); $percent = $starCount * 20; ?>
<cite class="p-name"><?php echo $cite; ?></cite>
<time class="dt-published" datetime="<?php the_time('Y-m-d h:i'); ?>"><?php echo $date; ?></time>
<?php if( $starCount ): ?>
<?php $ratingTotal += $starCount; $ratingCount++; $average = $ratingTotal / $ratingCount ?>
<data class="p-rating show-stars-wrapper" value="<?php echo $starCount ?>" title="<?php echo $starCount ?> Stars" >★★★★★
<div class="show-stars gray" style="width:100%;">★★★★★</div>
<div class="show-stars colored" style="width:<?php echo $percent ?>%; ">★★★★★</div>
</data>
<div style="display:none;"><?php echo $ratingTotal; ?>/<?php echo $ratingCount; ?>=<?php echo number_format($average,1); ?></div>
<?php endif; ?>
<div class="e-content">
<p>
<?php echo $review; ?>
</p>
</div>
</blockquote>
</div>
<?php endwhile; ?>
</section>
<?php if( current_user_can('administrator') and $average ): ?>
<div style="text-align:center; font-size:.75em; padding:6px 0; color:#666;">
Average Rating: <?php echo number_format($average,1); ?>
</div>
<?php endif; ?>
<?php endif; ?>
<script type="application/ld+json">
{ "@context": "http://schema.org",
"@type": "localbusiness",
"name": "<?php wp_title(); ?>",
"image": "<?php the_field('logo_url','option'); ?>",
"priceRange": "<?php the_field('price_range', 'option'); ?>",
"telephone": "<?php the_field('phone_number', 'option'); ?>",
"address": {
"@type": "PostalAddress",
"streetAddress": "<?php the_field('street_address', 'option'); ?>",
"addressLocality": "<?php the_field('city', 'option'); ?>",
"addressRegion": "<?php the_field('state_or_province', 'option'); ?>",
"postalCode": "<?php the_field('zip_code', 'option'); ?>"
}
<?php if( have_rows('testimonial_repeater') ): ?>
, "aggregateRating":
{"@type": "AggregateRating",
"ratingValue": "<?php echo number_format($average,1); ?>",
"reviewCount": "<?php echo $ratingCount; ?>"
}
<?php endif; ?>
}
</script>
<?php get_template_part( 'google', 'review' ); ?>
<?php get_template_part( 'service', 'areas' ); ?>
</article>
<?php if ( ! post_password_required() ) comments_template( '', true ); ?>
</main>
</div>
<?php get_footer(); ?>