forked from rotarytheme/rotary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
tmpl-speaker-archive.php
140 lines (123 loc) · 4.68 KB
/
tmpl-speaker-archive.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
130
131
132
133
134
135
136
137
138
139
140
<?php
/**
* Template Name: Speaker Archive
*
* @package WordPress
* @subpackage Rotary
* @since Rotary 1.0
*/
get_header();
$args = array();
$args['wp_query'] = array('post_type' => 'rotary_speakers',
'posts_per_page' => -1,
'orderby' => 'meta_value',
'meta_key' => 'speaker_date');
$args['fields'][] = array('type' => 'meta_key',
'format' => 'text',
'default' => '',
'compare' => 'LIKE',
'label' => 'First Name',
'meta_key' => 'speaker_first_name');
$args['fields'][] = array('type' => 'meta_key',
'format' => 'text',
'compare' => 'LIKE',
'label' => 'Last Name',
'meta_key' => 'speaker_last_name');
$args['fields'][] = array('type' => 'meta_key',
'format' => 'text',
'compare' => 'LIKE',
'label' => 'Organization',
'meta_key' => 'speaker_company');
$args['fields'][] = array('type' => 'meta_key',
'format' => 'text',
'label' => 'Job Title/Position',
'compare' => 'LIKE',
'meta_key' => 'speaker_title');
$args['fields'][] = array('type' => 'taxonomy',
'label' => 'Category',
'format' => 'select',
'allow_null' => 'Select a Category',
'taxonomy' => 'rotary_speaker_cat');
$args['fields'][] = array('type' => 'taxonomy',
'label' => 'Tag(s)',
'format' => 'select',
'allow_null' => 'Select a Tag',
'taxonomy' => 'rotary_speaker_tag');
$args['fields'][] = array('type' => 'meta_key',
'format' => 'text',
'label' => 'About the Speaker',
'compare' => 'IN',
'meta_key' => 'speaker_bio');
$args['fields'][] = array('type' => 'meta_key',
'format' => 'date',
'label' => 'Speaker Dates',
'compare' => '>=',
'data_type' => 'DATE',
'placeholder' => 'mm/dd/yyyy',
'meta_key' => 'speaker_date_from',
'sublabel' => 'From');
$args['fields'][] = array('type' => 'meta_key',
'format' => 'date',
'label' => ' ',
'sublabel' => 'To',
'compare' => '<=',
'data_type' => 'DATE',
'placeholder' => 'mm/dd/yyyy',
'meta_key' => 'speaker_date_to');
$args['fields'][] = array('type' => 'reset',
'value' => "Reset Filters");
$args['fields'][] = array('type' => 'submit',
'value' => 'Search');
$args['form'] = array('method' => 'POST');
//$args['relevanssi'] = true;
//instantiate search
$speaker_search = new WP_Advanced_Search($args); ?>
<h1 class="pagetitle"><span>Speaker Program</span></h1>
<div id="speakertabs" class="speakertabs">
<div id="tabs-1">
<?php //show the form ?>
<a id="search-toggle" href="#" class="search-toggle collapsed">Advanced Search</a>
<?php $speaker_search->the_form(); ?>
<?php $query = new WP_Query();
$query = $speaker_search->query();
?>
<div class="search-results">
<?php if ( $query->have_posts() ) : ?>
<table class="speaker-archive-table" id="speaker-archive-table">
<thead>
<tr>
<th>Speaker Link</th>
<th>Date</th>
<th>Program Title</th>
<th>Name</th>
<th>Job Title/Organization</th>
<th>Category</th>
</tr>
</thead>
<?php while ( $query->have_posts() ) : $query->the_post(); ?>
<?php $termField = ''; ?>
<?php $terms = wp_get_post_terms( get_the_id(), 'rotary_speaker_cat' ); ?>
<?php //print_r($terms);?>
<?php if ($terms) : ?>
<?php foreach ($terms as $term) : ?>
<?php if ($term === end($terms)) : ?>
<?php $termField .= $term->name; ?>
<?php rotary_output_archive_table($termField); ?>
<?php else : ?>
<?php $termField .= $term->name.', '; ?>
<?php endif; ?>
<?php endforeach; ?>
<?php else : ?>
<?php rotary_output_archive_table(); ?>
<?php endif; ?>
<?php endwhile; ?>
</table>
<?php else: ?>
<p class="nopseakers">There are no speakers that match your search criteria</p>
<?php endif;
// Reset Post Data
wp_reset_postdata();?>
</div><!--end div search-results-->
</div><!--end tab 1-->
</div> <!--end div speakertabs-->
<?php get_footer(); ?>