forked from okfde/jh-lauch-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpage-faq.php
61 lines (53 loc) · 1.93 KB
/
page-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
<?php
/**
* Template Name: FAQ
*/
get_header();
?>
<?php
while ( have_posts() ) :
the_post();
?>
<?php
get_template_part( 'template-parts/header-simple', get_post_type() ); ?>
<div class="c-page-section white">
<div class="c-toc" data-set-url="true">
<ul class="c-toc-nav">
<?php
$aud = get_terms('audience', 'orderby=id');
foreach ($aud as $audience) : ?>
<li><a href="#<?php echo $audience->slug; ?>" <?= $audience->slug === ($_GET['toc'] ?? "") ? 'class="is-active"' : '' ?>><?php echo $audience->name; ?></a></li>
<?php
endforeach ?>
</ul>
<div class="c-toc-content c-page-copy">
<?php
foreach ($aud as $audience) : ?>
<section id="<?php echo $audience->slug; ?>" <?= $audience->slug === ($_GET['toc'] ?? "") ? 'class="is-active"' : '' ?>>
<?php
$faqs = get_posts(array('post_type' => 'faq',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'audience',
'field' => 'slug',
'terms' => $audience->slug,
'include_children' => false
))));
foreach ($faqs as $faq) : ?>
<details <?= (($_GET['faq'] ?? "") == $faq->ID) ? 'open' : '' ?>>
<summary id="<?= $faq->ID ?>"><?php echo $faq->post_title; ?></summary>
<?php echo apply_filters( 'the_content', $faq->post_content ); ?>
</details>
<?php
endforeach; ?>
</section>
<?php
endforeach; ?>
<?php get_template_part( 'template-parts/contact-person', get_post_type() ); ?>
</div>
</div>
</div>
<?php
endwhile;
get_footer();