-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.php
147 lines (107 loc) · 4.72 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
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
141
142
143
144
145
146
<?php get_header();
global $options;
$theme_skin = ( !empty($options['theme-skin']) ) ? $options['theme-skin'] : 'original';
?>
<script>
jQuery(document).ready(function($){
var $searchContainer = $('#search-results');
$(window).load(function(){
$searchContainer.isotope({
itemSelector: '.result',
layoutMode: 'packery',
packery: { columnWidth: $('#search-results').width() / 3 }
});
$searchContainer.css('visibility','visible');
});
$(window).resize(function(){
$searchContainer.isotope({
layoutMode: 'packery',
packery: { columnWidth: $('#search-results').width() / 3}
});
});
});
</script>
<div class="container-wrap">
<div class="container main-content">
<div class="row">
<div class="col span_12">
<div class="col span_12 section-title">
<h1><?php echo __('Results For', NECTAR_THEME_NAME); ?><span>"<?php echo esc_html( get_search_query( false ) ); ?>"</span></h1>
<?php if($theme_skin == 'material' && $wp_query->found_posts) echo '<span class="result-num">' . $wp_query->found_posts . ' results found </span>'; ?>
</div>
</div>
</div>
<div class="divider"></div>
<div class="row">
<div class="col span_9">
<div id="search-results">
<?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<?php if( get_post_type($post->ID) == 'post' ){ ?>
<article class="result">
<div class="inner-wrap">
<span class="bottom-line"></span>
<?php if(has_post_thumbnail( $post->ID )) {
echo '<a href="'.get_permalink().'">'.get_the_post_thumbnail($post->ID, 'full', array('title' => '')).'</a>';
} ?>
<h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span><?php echo __('Blog Post', NECTAR_THEME_NAME); ?></span></h2>
</div>
</article><!--/search-result-->
<?php }
else if( get_post_type($post->ID) == 'page' ){ ?>
<article class="result">
<div class="inner-wrap">
<span class="bottom-line"></span>
<h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span><?php echo __('Page', NECTAR_THEME_NAME); ?></span></h2>
<?php if(has_excerpt()) the_excerpt(); ?>
</div>
</article><!--/search-result-->
<?php }
else if( get_post_type($post->ID) == 'portfolio' ){ ?>
<article class="result">
<div class="inner-wrap">
<span class="bottom-line"></span>
<?php if(has_post_thumbnail( $post->ID )) {
echo '<a href="'.get_permalink().'">'.get_the_post_thumbnail($post->ID, 'full', array('title' => '')).'</a>';
} ?>
<h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span><?php echo __('Portfolio Item', NECTAR_THEME_NAME); ?></span></h2>
</div>
</article><!--/search-result-->
<?php }
else if( get_post_type($post->ID) == 'product' ){ ?>
<article class="result">
<div class="inner-wrap">
<span class="bottom-line"></span>
<?php if(has_post_thumbnail( $post->ID )) {
echo '<a href="'.get_permalink().'">'. get_the_post_thumbnail($post->ID, 'full', array('title' => '')).'</a>';
} ?>
<h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> <span><?php echo __('Product', NECTAR_THEME_NAME); ?></span></h2>
</div>
</article><!--/search-result-->
<?php } else { ?>
<article class="result">
<div class="inner-wrap">
<span class="bottom-line"></span>
<?php if(has_post_thumbnail( $post->ID )) {
echo '<a href="'.get_permalink().'">'.get_the_post_thumbnail($post->ID, 'full', array('title' => '')).'</a>';
} ?>
<h2 class="title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
</div>
</article><!--/search-result-->
<?php } ?>
<?php endwhile;
else: echo "<p>" . __('No results found', NECTAR_THEME_NAME) . "</p>"; endif;?>
</div><!--/search-results-->
<?php if( get_next_posts_link() || get_previous_posts_link() ) { ?>
<div id="pagination">
<div class="prev"><?php previous_posts_link('« Previous Entries') ?></div>
<div class="next"><?php next_posts_link('Next Entries »','') ?></div>
</div>
<?php }?>
</div><!--/span_9-->
<div id="sidebar" class="col span_3 col_last">
<?php get_sidebar(); ?>
</div><!--/span_3-->
</div><!--/row-->
</div><!--/container-->
</div><!--/container-wrap-->
<?php get_footer(); ?>