-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
54 lines (40 loc) · 1.51 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
<?php
/*
Template Name: Search Page
*/
get_header('shop'); ?>
<?php // Preserving Search Page Results & Pagination
global $query_string;
$query_args = explode("&", $query_string);
$search_query = array();
foreach($query_args as $key => $string) {
$query_split = explode("=", $string);
$search_query[$query_split[0]] = urldecode($query_split[1]);
} // foreach
$search = new WP_Query($search_query);
?>
<!-- Search Template Content -->
<section class="searchPage">
<div>
<?php if ( have_posts() ) : ?>
<h1><?php printf( __( 'Search Results for : %s', 'jacvanek' ), '<span>' . get_search_query() . '</span>' ); ?></h1>
<?php //Start the Loop
while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><h3><?php the_title();?></h3></a>
<?php $thumb_size = 'medium' //Options (thumbnail - medium - large - full)?>
<a href="<?php the_permalink(); ?>"><?php the_post_thumbnail($thumb_size);?></a>
<?php// the_content(); ?>
<span class="line"></span>
<?php endwhile; ?>
<?php else : ?>
<h1 class="entry-title"><?php _e( 'Nothing Found', 'jacvanek' ); ?></h1>
<div>
<p><?php _e( 'Sorry, but nothing matched your search criteria. Please try again with some different keywords.', 'jacvanek' ); ?></p>
<div id="newSearch">
<?php get_search_form(); ?>
</div>
</div>
<?php endif; ?>
</div>
</section>
<?php get_footer('shop'); ?>