forked from ShawnZeng1996/Memory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
search.php
executable file
·148 lines (148 loc) · 6.51 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
<?php
/**
* ┌─┐┬ ┬┌─┐┬ ┬┌┐┌┌─┐┌─┐┌┐┌┌─┐ ┌─┐┌─┐┌┬┐
* └─┐├─┤├─┤││││││┌─┘├┤ ││││ ┬ │ │ ││││
* └─┘┴ ┴┴ ┴└┴┘┘└┘└─┘└─┘┘└┘└─┘o└─┘└─┘┴ ┴
*
* @package WordPress
* @Theme Memory
*
* @author [email protected]
* @link https://shawnzeng.com
*/
get_header(); ?>
<div id="main">
<div id="main-part">
<ul class="posts-list">
<li>
<article class="art">
<div class="art-main">
<h3 class="art-title">
<a href="#">搜索结果</a>
</h3>
</div>
</article>
</li>
<?php if ( have_posts() ) { ?>
<?php while ( have_posts() ) { the_post(); global $post; ?>
<?php if( $post->post_type== 'post' ) { ?>
<li>
<article class="art">
<header class="art-header">
<?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?>
<div class="right-box">
<h3 class="article-author"><?php the_author(); ?>
<i class="fa fa-check-circle"></i>
<span class="normal">发布了一篇文章</span>
</h3>
<h3 class="article-title"><a href="<?php the_permalink(); ?>" rel="bookmark">《<?php the_title(); ?>》</a></h3>
<div class="art-info">
<span class="art-info-date">
<i class="fa fa-calendar"></i> <?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . '前'; ?>
</span> •
<span class="art-info-category">
<i class="fa fa-archive"></i> <?php the_category( ', ' ); ?>
</span> •
<span class="art-info-tag">
<i class="fa fa-tags"></i> <?php the_tags('', ', ', ''); ?>
</span> •
<span class="art-info-view">
<i class="fa fa-eye"></i> <?php echo getPostViews(get_the_ID()); ?>
</span> •
<span class="art-info-comment">
<i class="fa fa-comment-o"></i> <?php comments_popup_link('0', '1', '%', '', '评论已关闭'); ?>
</span>
</div>
</div>
</header>
<div class="art-main">
<div class="art-content">
<?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
the_excerpt();
?>
</div>
<div class="article-info info-index">
<span class="post-like">
<a href="javascript:;" data-action="ding" data-id="<?php the_ID(); ?>" class="favorite<?php if(isset($_COOKIE['memory_ding_'.$post->ID])) echo ' done';?>"><span class="count">
<?php if( get_post_meta($post->ID,'memory_ding',true) ){
echo get_post_meta($post->ID,'memory_ding',true);
} else {
echo '0';
}?></span>
</a>
</span>
<span class="art-info-readmore">
<a href="<?php the_permalink(); ?>">
<i class="fa fa-ellipsis-h"></i> 阅读全文
</a>
</span>
</div>
</div>
</article>
</li>
<?php } ?>
<?php if( $post->post_type== 'shuoshuo' ) { ?>
<li>
<article class="shuoshuo">
<?php echo get_avatar( get_the_author_meta( 'ID' ) ); ?>
<div class="right-box">
<h3 class="shuoshuo-author"><?php the_author(); ?>
<i class="fa fa-check-circle"></i>
<span class="normal">发布了一条说说</span>
</h3>
<span class="shuoshuo-publish">
<span class="shuoshuo-time">
<i class="fa fa-calendar"></i> <?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . '前'; ?>
</span> •
<span class="art-info-view">
<i class="fa fa-eye"></i> <?php echo getPostViews(get_the_ID()); ?>
</span> •
<span class="art-info-comment">
<i class="fa fa-comment-o"></i> <?php comments_popup_link('0', '1', '%', '', '评论已关闭'); ?>
</span>
</span>
</div>
<div class="shuoshuo-content">
<p><?php the_content(); ?></p>
</div>
<div class="shuoshuo-info info-index">
<span class="post-like">
<a href="javascript:;" data-action="ding" data-id="<?php the_ID(); ?>" class="favorite<?php if(isset($_COOKIE['memory_ding_'.$post->ID])) echo ' done';?>"><span class="count">
<?php if( get_post_meta($post->ID,'memory_ding',true) ){
echo get_post_meta($post->ID,'memory_ding',true);
} else {
echo '0';
}?></span>
</a>
</span>
<span class="art-info-readmore">
<a href="<?php the_permalink(); ?>">
<i class="fa fa-ellipsis-h"></i> 参与讨论
</a>
</span>
</div>
</article>
</li>
<?php } ?>
<?php } ?>
<?php } else { ?>
<li>
<article class="art">
<div class="art-main">
<div class="art-intro">
<p>抱歉,没有找到相关文章!</p>
</div>
</div>
</article>
</li>
<?php } ?>
</ul>
<?php
memory_page_navi();
?>
</div>
<?php get_sidebar(); ?>
</div>
<?php get_footer(); ?>