-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate-q-a.php
77 lines (62 loc) · 1.77 KB
/
template-q-a.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
<?php
/**
* Template Name: Q & A
*
*
* @link https://codex.wordpress.org/Template_Hierarchy
*
* @package jwd
*/
$type = esc_html(get_field("post_type"));
get_header();
?>
<?php get_template_part('template-parts/part', 'inner-hero'); ?>
<div id="primary" class="content-area padding-site">
<main id="main" class="site-main container-site">
<section class="page-wrapper">
<div class="grid-x grid-margin-x">
<!-- Categories -->
<div class="cell medium-5 large-4">
<?php
$sidebar = get_field("sidebar");
$title = $sidebar['title'];
$tax = $type ."_category";
include(locate_template("template-parts/part-category-sidebar.php"));
?>
</div>
<!-- Results -->
<div id="js-ajax-scroll-to" class="cell medium-7 large-8 js-ajax-content-container">
<div class="js-ajax-results">
<?php
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$args = array(
"post_type" => $type,
"posts_per_page" => 5,
"paged" => $paged,
);
// Category
if (array_key_exists("cat", $_GET)){
$args['tax_query'] = array(
array(
"taxonomy" => $tax,
"field" => "slug",
"terms" => $_GET['cat'],
),
);
}
$query = new WP_Query($args);
if ($query->have_posts()) :
while ( $query->have_posts() ) : $query->the_post();
get_template_part('template-parts/q-a/part', 'accordions');
endwhile;
endif; ?>
<!-- Pagination -->
<?php pagination($query); wp_reset_postdata(); ?>
</div>
</div>
</div>
</section>
</main><!-- #main -->
</div><!-- #primary -->
<?php
get_footer();