Skip to content

Commit 5313ac7

Browse files
committed
Add search templates
1 parent 3b58d76 commit 5313ac7

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
### HEAD
2+
* Add search templates ([#1459](https://github.com/roots/sage/issues/1459))
3+
14
### 8.2.1: May 7th, 2015
25
* Update BrowserSync ([#1457](https://github.com/roots/sage/issues/1457))
36
* Bump dependencies ([#1448](https://github.com/roots/sage/issues/1448))

search.php

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?php get_template_part('templates/page', 'header'); ?>
2+
3+
<?php if (!have_posts()) : ?>
4+
<div class="alert alert-warning">
5+
<?php _e('Sorry, no results were found.', 'sage'); ?>
6+
</div>
7+
<?php get_search_form(); ?>
8+
<?php endif; ?>
9+
10+
<?php while (have_posts()) : the_post(); ?>
11+
<?php get_template_part('templates/content', 'search'); ?>
12+
<?php endwhile; ?>
13+
14+
<?php the_posts_navigation(); ?>

templates/content-search.php

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
<article <?php post_class(); ?>>
2+
<header>
3+
<h2 class="entry-title"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h2>
4+
<?php if (get_post_type() === 'post') { get_template_part('templates/entry-meta'); } ?>
5+
</header>
6+
<div class="entry-summary">
7+
<?php the_excerpt(); ?>
8+
</div>
9+
</article>

0 commit comments

Comments
 (0)