forked from chrisblakley/Nebula
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
86 lines (75 loc) · 2.64 KB
/
search.php
File metadata and controls
86 lines (75 loc) · 2.64 KB
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
<?php
/**
* The template for displaying Search Results pages.
*/
if ( !defined('ABSPATH') ){ //Redirect (for logging) if accessed directly
header('Location: http://' . $_SERVER['HTTP_HOST'] . substr($_SERVER['PHP_SELF'], 0, strpos($_SERVER['PHP_SELF'], "wp-content/")) . '?ndaat=' . basename($_SERVER['PHP_SELF']));
http_response_code(403);
die();
}
do_action('nebula_preheaders');
get_header(); ?>
<section id="bigheadingcon">
<div class="custom-color-overlay"></div>
<?php if ( get_theme_mod('menu_position', 'over') === 'over' ): ?>
<?php get_template_part('inc/navigation'); ?>
<?php endif; ?>
<div class="container title-desc-con">
<div class="row">
<div class="col">
<?php if ( have_posts() ): ?>
<h1 class="page-title">Search Results</h1>
<p class="page-meta">
Your search for <span class="search-term">"<?php echo get_search_query(); ?>"</span> returned
<?php
if ( file_exists(WP_PLUGIN_DIR . '/relevanssi') && $wp_query->found_posts ){ //If Relevanssi is enabled
echo $wp_query->found_posts;
} else {
$search_results = new WP_Query("s=$s&showposts=-1");
echo $search_results->post_count;
wp_reset_query();
}
?>
results.
</p>
<?php else: ?>
<h1 class="page title">No Results Found</h1>
<p>Your search for <span class="search-term">"<?php echo get_search_query(); ?>"</span> returned 0 results.</p>
<script>
ga('send', 'event', 'Internal Search', 'No Results', jQuery('#s').val(), {'nonInteraction': true});
</script>
<?php nebula()->append_visitor_data(array('no_search_results' => get_search_query()), false); ?>
<?php endif; ?>
<?php nebula()->append_visitor_data(array('internal_search' => get_search_query())); ?>
<?php echo nebula()->search_form(); ?>
</div><!--/cols-->
</div><!--/row-->
</div><!--/container-->
<div id="breadcrumb-section" class="full inner dark">
<div class="container">
<div class="row">
<div class="col">
<?php nebula()->breadcrumbs(); ?>
</div><!--/col-->
</div><!--/row-->
</div><!--/container-->
</div><!--/breadcrumb-section-->
</section>
<?php get_template_part('inc/nebula_drawer'); ?>
<div id="content-section">
<div class="container">
<div class="row">
<div class="col-md" role="main">
<?php if ( have_posts() ): ?>
<div id="searchresults">
<?php get_template_part('loop', 'search'); ?>
</div><!--/#searchresults-->
<?php else: ?>
<p>No search results.</p>
<?php endif; ?>
</div><!--/col-->
<?php get_sidebar(); ?>
</div><!--/row-->
</div><!--/container-->
</div><!--/content-section-->
<?php get_footer(); ?>