-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathpage-faq.php
129 lines (101 loc) · 3.13 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
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
<?php
/*
Template Name: Page Faq
*/
get_header();
?>
<div id="content" data-speed="3" >
<div id="inner-content" class="wrap clearfix">
<div id="main" role="main">
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$filter_cat_id = get_field('faq_filter_cat');
$args = array(
'child_of' => $filter_cat_id,
'orderby' => 'name',
'order' => 'ASC',
'hide_empty' => 0,
'hierarchical' => 1,
'taxonomy' => 'page_category',
);
$categories = get_categories( $args );
function sort_category_slug ($a, $b) {
return strcmp($a->slug,$b->slug);
}
usort($categories,'sort_category_slug');
if(!empty($categories)) { ?>
<div id = "faq-filters" class="fourcol first">
<?php
foreach ($categories as $key => $value) {
?>
<div class="faq-nav background-panel background-panel__slim">
<h2
class = "filter"
data-filter = ".cat-<?php echo $value->term_id; ?>"
>
<?php echo $value->name ?>
</h2>
</div>
<?php
}
} ?>
</div>
<div class="faq-groups mixitup-container eightcol last">
<?php
$faqs = get_field('faq');
if(!empty($faqs)) {
foreach ($categories as $key => $category) { ?>
<div class="background-panel mix cat-<?php echo $category->term_id; ?> entry-content" >
<h2><?php echo $category->name; ?></h2>
<div id="accordion-<?php echo $category->term_id; ?>" class="faq-accordion" >
<?php
foreach ($faqs as $key => $faq) {
foreach ($faq['faq_group'] as $key => $faq_group) {
if( $faq_group->term_id == $category->term_id ) {
$string = strtolower($faq['faq_question']);
$string = preg_replace("/ü/", "ue", $string);
$string = preg_replace("/ä/", "ae", $string);
$string = preg_replace("/ö/", "oe", $string);
$string = preg_replace("/ß/", "ss", $string);
$string = preg_replace("/[^a-z0-9_\s-]/", "", $string);
$string = preg_replace("/[\s-]+/", " ", $string);
$string = preg_replace("/[\s_]/", "-", $string);
?>
<h3
class ="faq-<?php echo $string;?>"
>
<?php echo $faq['faq_question']; ?>
</h3>
<div>
<?php echo $faq['faq_answer']; ?>
</div>
<?php
}
}
}
?>
</div>
</div>
<?php
}
}
?>
</div>
</div>
<?php endwhile; else : ?>
<article id="post-not-found" class="hentry clearfix">
<header class="article-header">
<h1><?php _e("Oops, Post Not Found!", "bonestheme"); ?></h1>
</header>
<section class="entry-content">
<p><?php _e("Uh Oh. Something is missing. Try double checking things.", "bonestheme"); ?></p>
</section>
<footer class="article-footer">
<p><?php _e("This is the error message in the page.php template.", "bonestheme"); ?></p>
</footer>
</article>
<?php endif; ?>
</div> <!-- end #main -->
</div> <!-- end #inner-content -->
</div> <!-- end #content -->
<?php get_footer(); ?>