forked from victorianwaderstudygroup/vwsg-theme
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
99 lines (83 loc) · 3.13 KB
/
search.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
<?php
/**
* Created by PhpStorm.
* User: Scott
* Date: 20/10/2018
* Time: 11:57 AM
*/
get_header();
?>
<div class="row">
<div class="col-xs-12 col-md-9 main col-md-offset-3">
<?php
get_breadcrumb();
?>
<div class="content">
<h1>Search</h1>
<div class="row">
<div class="col-md-10 col-md-offset-1">
<div class="btn-group btn-group-justified search_filters">
<div class="btn btn-default on" data-type="news">
<i class="far fa-newspaper"></i> News
</div>
<div class="btn btn-default on" data-type="page">
<i class="far fa-file-alt"></i> Pages
</div>
<div class="btn btn-default on" data-type="pdf">
<i class="far fa-file-pdf"></i> PDFs
</div>
</div>
</div>
</div>
<?php
if (have_posts()) :
$i = 1;
while (have_posts()) : the_post(); ?>
<?php
switch (get_post_type()) {
case 'attachment':
switch (get_post_mime_type()) {
case 'application/pdf':
$icon = 'far fa-file-pdf';
$type = 'pdf';
break;
}
break;
case 'page':
$icon = 'far fa-file-alt';
$type = 'page';
break;
case 'post':
$icon = 'far fa-newspaper';
$type = 'news';
break;
}
$type = isset($type) ? 'type-'.$type : '';
?>
<div class="search_result type-<?=$type?>">
<?php
if (isset($icon) && !empty($icon)):
?>
<i class="<?= $icon ?>"></i>
<?php
endif;
?>
<h4>
<a href="<?php the_permalink(); ?>"><?php the_title() ?></a></h4>
<?php the_excerpt(); ?>
</div>
<?php
endwhile;
else:
?>
<div class="search-result">
<p>No results found</p>
</div>
<?php
endif;
?>
</div>
</div>
</div>
<?php
get_footer();