forked from jarrettfuller/Wordpress_theme
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
56 lines (36 loc) · 1.13 KB
/
Copy pathsearch.php
File metadata and controls
56 lines (36 loc) · 1.13 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
<?php
/*
Template Name: Search Page
*/
?>
<?php get_header(); ?>
<?php
global $query_string;
$query_args = explode("&", $query_string);
$search_query = array();
if( strlen($query_string) > 0 ) {
foreach($query_args as $key => $string) {
$query_split = explode("=", $string);
$search_query[$query_split[0]] = urldecode($query_split[1]);
} // foreach
} //if
$search = new WP_Query($search_query);
?>
<div class="articles">
<?php if ( have_posts() ) : ?>
<?php /* Start the Loop */ ?>
<?php while ( have_posts() ) : the_post(); ?>
<?php get_template_part( 'content', 'search' ); ?>
<article>
<span class="date"><?php the_time('F j, Y'); ?></span>
<span class="post">
<h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3>
<p><?php the_excerpt(); ?></p>
</span>
</article>
<?php get_template_part( 'no-results', 'search' ); ?>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
</div>
<?php get_footer(); ?>