-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
84 lines (75 loc) · 2.53 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
<?php
/**
* The template for displaying search results pages.
*
*/
get_header(); ?>
<!-- CONTENT -->
<div id="Content" class="search">
<div class="wrapper clearfix">
<!-- MAIN -->
<article id="Main">
<div class="wrapper">
<form role="search" method="get" class="search" action="<?php echo site_url(); ?>">
<input type="search" class="text" placeholder="Search …" value="<?php printf( __( '%s', 'metanomalies' ), get_search_query() ); ?>" name="s" title="Search for: <?php printf( __( 'Search Results for: %s', 'metanomalies' ), get_search_query() ); ?>">
<input type="submit" class="submit" value="">
</form>
<?php if ( have_posts() ) : ?>
<!-- SEARCH RESULTS -->
<section class="block results">
<h2 class="title">
<?php
/* Search Count */
$allsearch = &new WP_Query("s=$s&showposts=-1");
$key = wp_specialchars($s, 1);
$count = $allsearch->post_count;
_e('');
echo $count . ' ';
_e('matches');
wp_reset_query();
?>
found for <strong>“<?php printf( __( '%s', 'metanomalies' ), get_search_query() ); ?>”</strong>
</h2>
<ul class="results">
<?php
// Start the loop.
while ( have_posts() ) : the_post();
?>
<li class="result">
<?php the_title( sprintf( '<h3 class="title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), '</a></h3>' ); ?>
<time class="date-published" datetime="<?php echo get_the_date( "Y-m-d h:ia" ); ?>"><?php echo get_the_date(); ?></time>
<div class="category">
<?php
$categories = get_the_category( );
$output = "";
if($categories){
foreach($categories as $category) {
$output .= '<a href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.'</a>';
}
echo $output;
}
?>
</div>
<?php the_excerpt(); ?>
</li>
<?php
// End the loop.
endwhile;
?>
</ul>
<!-- <div id="LoadingArticles" class="message loading"><i class="fa fa-spinner fa-spin"></i> Loading more articles…</div> -->
</section>
<!-- /SEARCH RESULTS -->
<?php
// If no content, include the "No posts found" template.
else :
get_template_part( 'content', 'none' );
endif;
?>
</div>
</article>
<!-- /MAIN -->
</div>
</div>
<!-- /CONTENT -->
<?php get_footer(); ?>