-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfront-page.php
More file actions
363 lines (327 loc) · 20.3 KB
/
Copy pathfront-page.php
File metadata and controls
363 lines (327 loc) · 20.3 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
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
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
<?php
$articles = new WP_Query(['posts_per_page' => 5]);
// Section Visibility Toggles (default to true/on)
// ACF true_false returns: 1 for true, 0 for false, null if never saved
$show_hero_stat = get_field('show_hero_stat', 'option') ?? true;
$show_perks = get_field('show_perks', 'option') ?? true;
$show_get_started = get_field('show_get_started', 'option') ?? true;
$show_programs = get_field('show_programs', 'option') ?? true;
$show_mission = get_field('show_mission', 'option') ?? true;
$show_as_seen = get_field('show_as_seen', 'option') ?? true;
$show_learn = get_field('show_learn', 'option') ?? true;
$show_testimonials = get_field('show_testimonials', 'option') ?? true;
$show_faq = get_field('show_faq', 'option') ?? true;
$show_newsletter = get_field('show_newsletter', 'option') ?? true;
// Get ACF settings for the banner
$banner_title = get_field('homepage_banner_title', 'option') ?: 'The benefits you deserve, the knowledge you need.';
$banner_subtitle = get_field('homepage_banner_subtitle', 'option') ?: 'Find assistance with Social Security disability, veterans affairs, and much more.';
$banner_button_text = get_field('homepage_banner_button_text', 'option') ?: 'See if you Qualify';
$banner_button_action = get_field('homepage_banner_button_action', 'option') ?: 'popup';
$banner_button_url = get_field('homepage_banner_button_url', 'option') ?: '';
$banner_button_target = get_field('homepage_banner_button_target', 'option') ?: false;
$banner_button_widget = get_field('homepage_banner_button_widget', 'option') ?: '';
// Hero Stat Bar
$hero_stat_icon = get_field('hero_stat_icon', 'option') ?: get_template_directory_uri() . '/assets/images/shield.webp';
$hero_stat_text_before = get_field('hero_stat_text_before', 'option') ?: "we're helping over";
$hero_stat_number = get_field('hero_stat_number', 'option') ?: '200,000 people';
$hero_stat_text_after = get_field('hero_stat_text_after', 'option') ?: 'each month to get the benefits they deserve.';
// Get Started Section
$get_started_label = get_field('get_started_label', 'option') ?: 'Get Started';
$get_started_title = get_field('get_started_title', 'option') ?: 'Find the perfect benefit plan for you.';
$get_started_description = get_field('get_started_description', 'option') ?: 'Our Benefits Quiz provides you with personalized plans so that you can get support that\'s right for you.';
$get_started_box_icon = get_field('get_started_box_icon', 'option') ?: get_template_directory_uri() . '/assets/images/edit_square.webp';
$get_started_box_title = get_field('get_started_box_title', 'option') ?: 'Take our quiz to discover which programs you qualify for.';
$get_started_box_button = get_field('get_started_box_button', 'option') ?: 'Take the Benefits Quiz';
$get_started_box_image = get_field('get_started_box_image', 'option') ?: get_template_directory_uri() . '/assets/images/front-page-get-started-box-bg.webp';
// Featured Programs Section
$programs_title = get_field('programs_title', 'option') ?: 'Featured programs';
// Mission Section
$mission_label = get_field('mission_label', 'option') ?: 'Our Mission';
$mission_text = get_field('mission_text', 'option') ?: '<p>At Ampry One®, we offer the information, tools, and guidance you need to navigate government-funded benefit programs and services.</p><p><b>And it\'s 100% free.</b></p>';
$mission_button_text = get_field('mission_button_text', 'option') ?: 'Learn more about us';
$mission_button_link = get_field('mission_button_link', 'option') ?: '/about';
// As Seen In Section
$as_seen_title = get_field('as_seen_title', 'option') ?: 'Previously Featured';
$as_seen_image = get_field('as_seen_image', 'option') ?: get_template_directory_uri() . '/assets/images/as-seen-in.webp';
// Learn Section
$learn_label = get_field('learn_label', 'option') ?: 'Learn';
$learn_title = get_field('learn_title', 'option') ?: 'Recent articles';
$learn_description = get_field('learn_description', 'option') ?: 'Our team of benefits experts have created the resources about local, state, and federally funded benefit programs to help you find the right program to suit your needs.';
$learn_button_text = get_field('learn_button_text', 'option') ?: 'Explore more articles';
$learn_button_link = get_field('learn_button_link', 'option') ?: '/learn';
// Testimonials Section
$testimonials_label = get_field('testimonials_label', 'option') ?: 'Our Testimonials';
$testimonials_title = get_field('testimonials_title', 'option') ?: 'What people are saying';
// FAQ Section
$faq_title = get_field('faq_title', 'option') ?: 'Frequently asked questions';
// Repeater fields with defaults (check for empty arrays and filter empty rows)
$perks = get_field('perks', 'option');
if (!empty($perks)) {
$perks = array_filter($perks, function($p) { return !empty($p['title']); });
}
if (empty($perks)) {
$perks = array(
array('icon' => get_template_directory_uri() . '/assets/images/star.webp', 'title' => 'Discover benefits', 'description' => 'Find benefit plans tailored to you.'),
array('icon' => get_template_directory_uri() . '/assets/images/forum.webp', 'title' => 'Receive expert guidance', 'description' => 'Navigate confidently with our help.'),
array('icon' => get_template_directory_uri() . '/assets/images/thumb_up.webp', 'title' => 'No-Cost Guides and Resources', 'description' => 'Learn about the benefits you deserve.'),
);
} else {
// Ensure icons have fallbacks when empty
$perk_icon_fallbacks = array(
'star.webp', // First perk
'forum.webp', // Second perk
'thumb_up.webp', // Third perk
);
$i = 0;
foreach ($perks as &$perk) {
if (empty($perk['icon']) && isset($perk_icon_fallbacks[$i])) {
$perk['icon'] = get_template_directory_uri() . '/assets/images/' . $perk_icon_fallbacks[$i];
}
$i++;
}
unset($perk); // break reference
}
$programs = get_field('programs', 'option');
if (!empty($programs)) {
$programs = array_filter($programs, function($p) { return !empty($p['title']); });
}
if (empty($programs)) {
$programs = array(
array('icon' => get_template_directory_uri() . '/assets/images/veteran.webp', 'title' => 'Veteran (VA)', 'description' => 'Take the first steps towards maximizing your Veteran Benefits', 'link' => home_url('/category/veterans-benefits/'), 'background_image' => get_template_directory_uri() . '/assets/images/veteran-bg.webp'),
array('icon' => get_template_directory_uri() . '/assets/images/ssdi.webp', 'title' => 'Disability (SSDI)', 'description' => 'Get help with Social Security Disability Insurance benefits', 'link' => home_url('/category/social-security-disability/'), 'background_image' => get_template_directory_uri() . '/assets/images/ssdi-bg.webp'),
array('icon' => get_template_directory_uri() . '/assets/images/grants.webp', 'title' => 'Grants', 'description' => 'Discover how to qualify for life-changing grants and assistance', 'link' => home_url('/category/employment-benefits/'), 'background_image' => get_template_directory_uri() . '/assets/images/grants-bg.webp'),
);
} else {
// Ensure icons and background images have fallbacks
$default_bg_images = array(
get_template_directory_uri() . '/assets/images/veteran-bg.webp',
get_template_directory_uri() . '/assets/images/ssdi-bg.webp',
get_template_directory_uri() . '/assets/images/grants-bg.webp',
);
$default_icons = array(
get_template_directory_uri() . '/assets/images/veteran.webp',
get_template_directory_uri() . '/assets/images/ssdi.webp',
get_template_directory_uri() . '/assets/images/grants.webp',
);
$i = 0;
foreach ($programs as &$program) {
if (empty($program['icon']) && isset($default_icons[$i])) {
$program['icon'] = $default_icons[$i];
}
if (empty($program['background_image']) && isset($default_bg_images[$i])) {
$program['background_image'] = $default_bg_images[$i];
}
$i++;
}
unset($program); // break reference
}
$testimonials = get_field('testimonials', 'option');
// Filter out empty testimonials and use defaults if none have content
if (!empty($testimonials)) {
$testimonials = array_filter($testimonials, function($t) {
return !empty($t['quote']);
});
}
if (empty($testimonials)) {
$testimonials = array(
array('quote' => 'My life has changed tremendously. The medical evidence and documentation provided by your team increased my success with my case', 'name' => 'D. Allen', 'title' => 'Navy'),
array('quote' => 'I will be receiving my first check sometime next week. Knowing that I will be getting a check monthly will put a huge ease on my family.', 'name' => 'L. Turville', 'title' => 'Navy'),
array('quote' => 'My life has been extremely changed because of you. I would still be in the same boat struggling now as I have been. It has only been a few months but now life is so much better!', 'name' => 'B. Quisenberry', 'title' => 'Navy'),
);
}
$faqs = get_field('faqs', 'option');
if (!empty($faqs)) {
$faqs = array_filter($faqs, function($f) { return !empty($f['question']); });
}
if (empty($faqs)) {
$faqs = array(
array('question' => 'How much does Ampry One cost?', 'answer' => 'Our mission at Ampry One is to simplify the process of finding and understanding government benefits. To support our platform and research, we may earn a commission when you connect with a service we recommend. This allows us to continue our work of helping you discover the benefits you deserve.'),
array('question' => 'How does Ampry One help people?', 'answer' => 'Our mission is to make government benefits easy for everyone to understand. We offer detailed guides, application tips, eligibility information, and personalized tools to help individuals navigate the challenges of programs like VA disability, SNAP, SSDI, and Section 8 housing. We want to simplify the process and reduce the stress of applying for government benefits.'),
array('question' => 'What resources can I find on Ampry One?', 'answer' => 'On Ampry One, you\'ll find a wide range of resources including interactive tools, step-by-step application guides, comprehensive FAQs, and up-to-date news related to government benefits. We also offer personalized advice sections, benefits calculators, and resources specifically for veterans, disabled individuals, and low-income families.'),
array('question' => 'Is Ampry One a government agency?', 'answer' => 'No, Ampry One is not a government agency. We are an independent resource that provides information and guidance on government benefits. While we strive to offer accurate and helpful information, our site serves as a bridge to make government programs more accessible and understandable for the public, rather than an official government body.'),
);
}
get_header(); ?>
<section class="front-page-welcome">
<div class="c">
<h1><?php echo esc_html($banner_title); ?></h1>
<p><?php echo esc_html($banner_subtitle); ?></p>
<?php
// Render button based on action type
if ($banner_button_action !== 'none' && !empty($banner_button_text)):
$button_html = '';
$target_attr = $banner_button_target ? ' target="_blank" rel="noopener noreferrer"' : '';
switch ($banner_button_action) {
case 'url':
if (!empty($banner_button_url)) {
$button_html = '<a href="' . esc_url($banner_button_url) . '" class="btn"' . $target_attr . '>' . esc_html($banner_button_text) . '</a>';
}
break;
case 'popup':
$button_html = '<span class="btn toggle-dt-popup">' . esc_html($banner_button_text) . '</span>';
break;
case 'widget':
if (!empty($banner_button_widget)) {
$button_html = '<span class="btn toggle-widget-popup" data-widget="' . esc_attr($banner_button_widget) . '">' . esc_html($banner_button_text) . '</span>';
}
break;
}
if (!empty($button_html)) {
echo $button_html;
}
endif;
?>
<?php if ($show_hero_stat): ?>
<div class="front-page-welcome-stat">
<div class="c">
<p><img src="<?php echo esc_url($hero_stat_icon); ?>">As of <?php echo date('F Y'); ?>, <?php echo esc_html($hero_stat_text_before); ?> <span><?php echo esc_html($hero_stat_number); ?></span> <?php echo esc_html($hero_stat_text_after); ?></p>
</div><!-- c -->
</div><!-- front-page-welcome-stat -->
<?php endif; ?>
</div><!-- c -->
</section><!-- front-page-welcome -->
<?php if ($show_perks): ?>
<section class="front-page-perks">
<div class="c">
<div class="grid-50">
<?php foreach ($perks as $perk): ?>
<div class="col-1-3">
<div class="front-page-perks-box">
<img src="<?php echo esc_url($perk['icon']); ?>">
<h5><?php echo esc_html($perk['title']); ?></h5>
<p><?php echo esc_html($perk['description']); ?></p>
</div><!-- front-page-perks-box -->
</div><!-- col-1-3 -->
<?php endforeach; ?>
</div><!-- grid-50 -->
</div><!-- c -->
</section><!-- front-page-perks -->
<?php endif; ?>
<?php if ($show_get_started): ?>
<section class="front-page-get-started">
<div class="c">
<div class="grid-50">
<div class="col-1-3">
<h4><?php echo esc_html($get_started_label); ?></h4>
<h2><?php echo esc_html($get_started_title); ?></h2>
<p><?php echo esc_html($get_started_description); ?></p>
</div><!-- col -->
<div class="col-2-3">
<a href="/" class="front-page-get-started-box toggle-dt-popup">
<div class="front-page-get-started-box-bg" style="background-image: url('<?php echo esc_url($get_started_box_image); ?>');"></div>
<img class="front-page-get-started-box-img" src="<?php echo esc_url($get_started_box_icon); ?>">
<h3><?php echo esc_html($get_started_box_title); ?></h3>
<span class="btn"><?php echo esc_html($get_started_box_button); ?></span>
</a><!-- front-page-get-started-box -->
</div><!-- col -->
</div><!-- grid-50 -->
</div><!-- c -->
</section><!-- front-page-get-started -->
<?php endif; ?>
<?php if ($show_programs): ?>
<section class="front-page-featured-programs">
<div class="c">
<h2><?php echo esc_html($programs_title); ?></h2>
<div class="grid-50">
<?php foreach ($programs as $program):
$bg_style = !empty($program['background_image']) ? 'background-image: url(' . esc_url($program['background_image']) . ');' : '';
?>
<div class="col-1-3">
<a href="<?php echo esc_url($program['link']); ?>" class="front-page-featured-programs-box">
<?php if (!empty($program['background_image'])): ?>
<div class="program-bg-image" style="<?php echo esc_attr($bg_style); ?>"></div>
<?php endif; ?>
<img src="<?php echo esc_url($program['icon']); ?>">
<h3><?php echo esc_html($program['title']); ?></h3>
<p><?php echo esc_html($program['description']); ?></p>
<span class="learn-more">Learn More</span>
</a><!-- front-page-featured-programs-box -->
</div><!-- col -->
<?php endforeach; ?>
</div><!-- grid-20 -->
</div><!-- c -->
</section><!-- front-page-featured-programs -->
<?php endif; ?>
<?php if ($show_mission): ?>
<section class="front-page-mission">
<div class="c">
<div class="front-page-mission-box">
<h4><?php echo esc_html($mission_label); ?></h4>
<?php echo $mission_text; ?>
<a class="btn" href="<?php echo esc_url($mission_button_link); ?>"><?php echo esc_html($mission_button_text); ?></a>
</div><!-- front-page-mission-box -->
</div><!-- c -->
</section><!-- front-page-mission -->
<?php endif; ?>
<?php if ($show_as_seen): ?>
<section class="front-page-as-seen-in">
<div class="c">
<h5><?php echo esc_html($as_seen_title); ?></h5>
<img src="<?php echo esc_url($as_seen_image); ?>">
</div><!-- c -->
</section><!-- front-page-as-seen-in -->
<?php endif; ?>
<?php if ($show_learn): ?>
<section class="front-page-learn">
<div class="c">
<div class="grid-50 clear-col-3">
<div class="col-1-3">
<h4><?php echo esc_html($learn_label); ?></h4>
<h2><?php echo esc_html($learn_title); ?></h2>
<p><?php echo esc_html($learn_description); ?></p>
<a class="btn" href="<?php echo esc_url($learn_button_link); ?>"><?php echo esc_html($learn_button_text); ?></a>
</div><!-- col -->
<?php while ($articles->have_posts()): $articles->the_post(); ?>
<div class="col-1-3">
<div class="front-page-learn-box">
<a
class="front-page-learn-box-img"
href="<?php the_permalink(); ?>"
style="background-image: url('<?php the_post_thumbnail_url(get_the_ID(), 'medium'); ?>');">
</a>
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<?php get_template_part('template-parts/components/byline'); ?>
</div><!-- front-page-learn-box -->
</div><!-- col-1-3 -->
<?php endwhile; ?>
<?php wp_reset_postdata(); ?>
</div><!-- grid -->
</div><!-- c -->
</section><!-- front-page-learn -->
<?php endif; ?>
<?php if ($show_testimonials): ?>
<section class="front-page-reviews">
<div class="c">
<h4><?php echo esc_html($testimonials_label); ?></h4>
<h2><?php echo esc_html($testimonials_title); ?></h2>
<div class="grid-50">
<?php foreach ($testimonials as $testimonial): ?>
<?php if (empty($testimonial['quote'])) continue; ?>
<div class="col-1-3">
<div class="front-page-reviews-box">
<p>"<?php echo esc_html($testimonial['quote']); ?>"</p>
<h5><?php echo esc_html($testimonial['name']); ?></h5>
<h6><?php echo esc_html($testimonial['title']); ?></h6>
</div><!-- front-page-reviews-box -->
</div><!-- col -->
<?php endforeach; ?>
</div><!-- grid-50 -->
</div><!-- c -->
</section><!-- front-page-reviews -->
<?php endif; ?>
<?php if ($show_faq): ?>
<section class="front-page-faq" itemscope itemtype="https://schema.org/FAQPage">
<div class="c slim">
<h2><?php echo esc_html($faq_title); ?></h2>
<ul class="faq">
<?php foreach ($faqs as $faq): ?>
<li itemscope itemprop="mainEntity" itemtype="https://schema.org/Question"><span itemprop="name"><?php echo esc_html($faq['question']); ?></span><div itemscope itemprop="acceptedAnswer" itemtype="https://schema.org/Answer"><span itemprop="text"><?php echo esc_html($faq['answer']); ?></span></div></li>
<?php endforeach; ?>
</ul>
</div><!-- c slim -->
</section><!-- front-page-faq -->
<?php endif; ?>
<?php if ($show_newsletter): ?>
<?php get_template_part('template-parts/sections/newsletter'); ?>
<?php endif; ?>
<?php get_footer(); ?>