-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsearch.php
More file actions
55 lines (55 loc) · 1.9 KB
/
search.php
File metadata and controls
55 lines (55 loc) · 1.9 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
<?php get_header();?>
<?php global $wp_query;?>
<div class="container" role="main">
<div class="row">
<div class="col-lg-12 search-content">
<h1 class="page-title"><?php printf( __( 'Found %d Search Results for the term: %s' ), $wp_query->found_posts, get_search_query() ); ?></h1>
<hr>
<?php if (have_posts()) : while ( have_posts() ) : the_post(); ?>
<div class="search-item">
<h2 class='orbit-title'><a href='<?php the_permalink();?>'><?php the_title();?></a></h2>
<?php if ( get_post_type() == 'post' ) echo "<span class='search-post-type'>Webzine Article</span>";
elseif (get_post_type() == 'resources' ) echo "<span class='search-post-type'>Service Provider</span>";
else echo "<span class='search-post-type'>Website page</span>";?>
<?php $excerpt = get_the_excerpt();?>
<?php if( $excerpt ): ?><div class='orbit-excerpt'><?php _e( $excerpt );?> | <a class='search-post-link' href='<?php the_permalink();?>' aria-label="View <?php the_title();?>">View Result</a></div><?php endif;?>
</div>
<?php endwhile;?>
<?php
else :
printf( __('Sorry, but nothing matched your search terms. Please try again with some different keywords.') );
endif;
?>
</div>
</div>
</div>
<?php if ( have_posts() ): ?>
<!-- Previous/next page navigation. -->
<div class="container-fluid search-pagination" role="navigation">
<div class="container text-center">
<?php
the_posts_pagination(
array(
'mid_size' => 1,
'prev_text' => __( '«' ),
'next_text' => __( '»' ),
'screen_reader_text' => __( ' ' ),
)
);
?>
</div>
</div>
<?php endif;?>
<style>
.search-post-type {
display: inline-block;
margin:6px 0;
padding:2px 6px;
color:white;
background:#222;
}
.search-post-link {
border-bottom:1px solid;
}
</style>
<?php get_footer();?>