-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfaq.php
76 lines (66 loc) · 2.71 KB
/
faq.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
<?php /*Template Name: FAQ Page Template */ ?>
<?php
get_header();
?>
<?php
while (have_posts()) : the_post();
?>
<div class="parallax-container valign-wrapper">
<div class="parallax">
<!--show hero image -->
<?php $hero = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'full'); ?>
<!-- get the alt image else take the title as a alt of the image-->
<?php
$alt=get_the_post_thumbnail_caption();
if ($alt != get_the_post_thumbnail_caption()) {
$alt = get_the_title();
}
?>
<img src="<?php echo $hero['0'];?>" alt="<?php echo $alt?> ">
</div>
</div>
<h1 class="center">
<?php echo the_title();?>
</h1>
<div class="container">
<div class="row">
<div class="col s12 offset-l2 l8">
<?php the_content();?>
<hr class="whitespace">
<?php
if( have_rows('sections') ):
while( have_rows('sections') ): the_row();
$title = get_sub_field('title');//get the title of the section
?>
<h2><?php echo $title;?></h2>
<?php
if( have_rows('questions_answers') ): ?>
<ul class="collapsible">
<?php while( have_rows('questions_answers') ): the_row();
$question = get_sub_field('question');//get the questions
?>
<li>
<div class="collapsible-header">
<?php echo $question;?>
</div>
<div class="collapsible-body">
<?php
$answer = get_sub_field('answer');//get the answers
echo $answer;?>
</div>
</li>
<?php
endwhile; // End While have_rows('questions_answers')
echo '</ul>';
endif;//End if have_rows('questions_answers')
endwhile;//End while have_rows('sections')
endif;//first if have_rows('sections')
?>
</div>
</div>
</div>
<div>
<?php endwhile;?>
<?php
get_footer();
?>