-
Notifications
You must be signed in to change notification settings - Fork 1
/
search.php
72 lines (39 loc) · 1.63 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
<?php get_header(); ?>
<div id="content">
<div id="inner-content">
<main id="main" role="main">
<section class="paddings">
<h1 class="archive-title"><span><?php _e( 'Search Results for', 'bonestheme' ); ?></span> <em><?php echo esc_attr(get_search_query()); ?></em></h1>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
if ($post->post_parent) {
$ancestors=get_post_ancestors($post->ID);
$root=count($ancestors)-1;
$parent = $ancestors[$root];
} else {
$parent = $post->ID;
}
$permalink = get_permalink( $parent );
$sectionlink = ( $parent == $post->ID ? '' : '#page-item-' . $post->ID );
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?> role="article">
<header class="entry-header article-header">
<h2 class="search-title entry-title"><a href="<?php echo $permalink . $sectionlink; ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>
</header>
<section class="entry-content">
<?php the_excerpt( '<span class="read-more">' . __( 'Read more »', 'bonestheme' ) . '</span>' ); ?>
</section>
</article>
<?php endwhile; ?>
<?php bones_page_navi(); ?>
<?php else : ?>
<article id="post-not-found" class="hentry">
<h3>Sorry, nothing was found.</h3>
<p>Please try your search again.</p>
</article>
<?php endif; ?>
</section>
</main>
</div>
</div>
<?php get_footer(); ?>